mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 01:46:04 +00:00
Moved batch packet handling into BatchPacket->handle(), fixed data packet receive timings to include MCPE packet decode time
This commit is contained in:
@ -112,7 +112,6 @@ use pocketmine\network\mcpe\protocol\AddPlayerPacket;
|
||||
use pocketmine\network\mcpe\protocol\AdventureSettingsPacket;
|
||||
use pocketmine\network\mcpe\protocol\AnimatePacket;
|
||||
use pocketmine\network\mcpe\protocol\AvailableCommandsPacket;
|
||||
use pocketmine\network\mcpe\protocol\BatchPacket;
|
||||
use pocketmine\network\mcpe\protocol\BlockEntityDataPacket;
|
||||
use pocketmine\network\mcpe\protocol\BlockEventPacket;
|
||||
use pocketmine\network\mcpe\protocol\ChangeDimensionPacket;
|
||||
@ -1959,11 +1958,6 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
||||
return false;
|
||||
}
|
||||
|
||||
public function handleBatch(BatchPacket $packet) : bool{
|
||||
$this->server->getNetwork()->processBatch($packet, $this);
|
||||
return true;
|
||||
}
|
||||
|
||||
public function handleResourcePacksInfo(ResourcePacksInfoPacket $packet) : bool{
|
||||
return false;
|
||||
}
|
||||
@ -3303,6 +3297,9 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
||||
$timings = Timings::getReceiveDataPacketTimings($packet);
|
||||
$timings->startTiming();
|
||||
|
||||
$packet->decode();
|
||||
assert($packet->feof(), "Still " . strlen(substr($packet->buffer, $packet->offset)) . " bytes unread in " . get_class($packet));
|
||||
|
||||
$this->server->getPluginManager()->callEvent($ev = new DataPacketReceiveEvent($this, $packet));
|
||||
if(!$ev->isCancelled() and !$packet->handle($this)){
|
||||
$this->server->getLogger()->debug("Unhandled " . get_class($packet) . " received from " . $this->getName());
|
||||
|
Reference in New Issue
Block a user