diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index fc99468..fb2d33e 100755 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -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; @@ -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; } diff --git a/src/pocketmine/network/mcpe/PlayerNetworkSessionAdapter.php b/src/pocketmine/network/mcpe/PlayerNetworkSessionAdapter.php index 2b44999..16e6766 100755 --- a/src/pocketmine/network/mcpe/PlayerNetworkSessionAdapter.php +++ b/src/pocketmine/network/mcpe/PlayerNetworkSessionAdapter.php @@ -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; @@ -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); - } } \ No newline at end of file diff --git a/src/pocketmine/network/mcpe/protocol/PingPacket.php b/src/pocketmine/network/mcpe/protocol/PingPacket.php deleted file mode 100644 index 8a6935e..0000000 --- a/src/pocketmine/network/mcpe/protocol/PingPacket.php +++ /dev/null @@ -1,25 +0,0 @@ -ping = $this->getVarInt(); - } - - protected function encodePayload(){ - $this->putVarInt($this->ping); - } - - public function handle(NetworkSession $session) : bool{ - return $session->handlePing($this); - } -} \ No newline at end of file