mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 02:08:21 +00:00
Use short class names for unhandled packet logging, added some documentation
This commit is contained in:
@ -40,6 +40,10 @@ abstract class DataPacket extends BinaryStream{
|
||||
return $this::NETWORK_ID;
|
||||
}
|
||||
|
||||
public function getName() : string{
|
||||
return (new \ReflectionClass($this))->getShortName();
|
||||
}
|
||||
|
||||
public function canBeBatched() : bool{
|
||||
return true;
|
||||
}
|
||||
@ -52,6 +56,16 @@ abstract class DataPacket extends BinaryStream{
|
||||
|
||||
abstract public function decode();
|
||||
|
||||
/**
|
||||
* Performs handling for this packet. Usually you'll want an appropriately named method in the NetworkSession for this.
|
||||
*
|
||||
* This method returns a bool to indicate whether the packet was handled or not. If the packet was unhandled, a debug message will be logged with a hexdump of the packet.
|
||||
* Typically this method returns the return value of the handler in the supplied NetworkSession. See other packets for examples how to implement this.
|
||||
*
|
||||
* @param NetworkSession $session
|
||||
*
|
||||
* @return bool true if the packet was handled successfully, false if not.
|
||||
*/
|
||||
abstract public function handle(NetworkSession $session) : bool;
|
||||
|
||||
public function reset(){
|
||||
|
Reference in New Issue
Block a user