mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 09:56:06 +00:00
Fixed DataPacketReceiveEvent, fixed packet receive timings, gave Player->handleDataPacket() a new use
This commit is contained in:
@ -3291,7 +3291,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: get rid of these remains, fix DataPacketReceiveEvent, fix timings
|
||||
* Called when a packet is received from the client. This method will call DataPacketReceiveEvent.
|
||||
*
|
||||
* @param DataPacket $packet
|
||||
*/
|
||||
@ -3300,18 +3300,14 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$timings = Timings::getReceiveDataPacketTimings($packet);
|
||||
|
||||
$timings->startTiming();
|
||||
|
||||
$this->server->getPluginManager()->callEvent($ev = new DataPacketReceiveEvent($this, $packet));
|
||||
if($ev->isCancelled()){
|
||||
$timings->stopTiming();
|
||||
return;
|
||||
if(!$ev->isCancelled() and !$packet->handle($this)){
|
||||
$this->server->getLogger()->debug("Unhandled " . get_class($packet) . " received from " . $this->getName());
|
||||
}
|
||||
|
||||
|
||||
$timings->stopTiming();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user