Skip to content

Commit

Permalink
Better Anvil and Deleted PingPacket
Browse files Browse the repository at this point in the history
Fixed issue that XP is not consumed on client-side only
  • Loading branch information
towa0131 committed Jun 15, 2018
1 parent 34d1716 commit e023d04
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 31 deletions.
10 changes: 9 additions & 1 deletion src/pocketmine/Player.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@
use pocketmine\network\mcpe\protocol\MobEquipmentPacket;
use pocketmine\network\mcpe\protocol\ModalFormResponsePacket;
use pocketmine\network\mcpe\protocol\MovePlayerPacket;
use pocketmine\network\mcpe\protocol\PingPacket;
use pocketmine\network\mcpe\protocol\PlayerActionPacket;
use pocketmine\network\mcpe\protocol\PlayerHotbarPacket;
use pocketmine\network\mcpe\protocol\PlayerInputPacket;
Expand Down Expand Up @@ -2338,6 +2337,15 @@ public function handleEntityEvent(EntityEventPacket $packet) : bool{
$this->dataPacket($packet);
$this->server->broadcastPacket($this->getViewers(), $packet);
break;
case EntityEventPacket::ENCHANT:
if($packet->data === 0){
return false;
}

if($this->isSurvival()){
$this->addXpLevel($packet->data);
}
break;
default:
return false;
}
Expand Down
5 changes: 0 additions & 5 deletions src/pocketmine/network/mcpe/PlayerNetworkSessionAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
use pocketmine\network\mcpe\protocol\MobEquipmentPacket;
use pocketmine\network\mcpe\protocol\ModalFormResponsePacket;
use pocketmine\network\mcpe\protocol\MovePlayerPacket;
use pocketmine\network\mcpe\protocol\PingPacket;
use pocketmine\network\mcpe\protocol\PlayerActionPacket;
use pocketmine\network\mcpe\protocol\PlayerHotbarPacket;
use pocketmine\network\mcpe\protocol\PlayerInputPacket;
Expand Down Expand Up @@ -244,8 +243,4 @@ public function handleModalFormResponse(ModalFormResponsePacket $packet) : bool{
public function handleServerSettingsRequest(ServerSettingsRequestPacket $packet) : bool{
return false; //TODO: GUI stuff
}

public function handlePing(PingPacket $packet) : bool{
return $this->player->handlePing($packet);
}
}
25 changes: 0 additions & 25 deletions src/pocketmine/network/mcpe/protocol/PingPacket.php

This file was deleted.

0 comments on commit e023d04

Please sign in to comment.