From d9da9accbca91641b8176c5ef88ae91501630979 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Sun, 6 Aug 2017 13:20:56 +0100 Subject: [PATCH] Fix packet buffers when encoding twice --- src/pocketmine/network/mcpe/protocol/DataPacket.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/pocketmine/network/mcpe/protocol/DataPacket.php b/src/pocketmine/network/mcpe/protocol/DataPacket.php index c6dec0c87..562ba446f 100644 --- a/src/pocketmine/network/mcpe/protocol/DataPacket.php +++ b/src/pocketmine/network/mcpe/protocol/DataPacket.php @@ -84,6 +84,7 @@ abstract class DataPacket extends BinaryStream{ public function encode(){ $this->reset(); + $this->encodeHeader(); $this->encodePayload(); $this->isEncoded = true; } @@ -114,11 +115,6 @@ abstract class DataPacket extends BinaryStream{ */ abstract public function handle(NetworkSession $session) : bool; - public function reset(){ - $this->encodeHeader(); - $this->offset = 0; - } - public function clean(){ $this->buffer = null; $this->isEncoded = false;