mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-18 20:14:31 +00:00
Fix packet buffers when encoding twice
This commit is contained in:
@@ -84,6 +84,7 @@ abstract class DataPacket extends BinaryStream{
|
|||||||
|
|
||||||
public function encode(){
|
public function encode(){
|
||||||
$this->reset();
|
$this->reset();
|
||||||
|
$this->encodeHeader();
|
||||||
$this->encodePayload();
|
$this->encodePayload();
|
||||||
$this->isEncoded = true;
|
$this->isEncoded = true;
|
||||||
}
|
}
|
||||||
@@ -114,11 +115,6 @@ abstract class DataPacket extends BinaryStream{
|
|||||||
*/
|
*/
|
||||||
abstract public function handle(NetworkSession $session) : bool;
|
abstract public function handle(NetworkSession $session) : bool;
|
||||||
|
|
||||||
public function reset(){
|
|
||||||
$this->encodeHeader();
|
|
||||||
$this->offset = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function clean(){
|
public function clean(){
|
||||||
$this->buffer = null;
|
$this->buffer = null;
|
||||||
$this->isEncoded = false;
|
$this->isEncoded = false;
|
||||||
|
Reference in New Issue
Block a user