mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 17:59:48 +00:00
Merge conflict resolution
This commit is contained in:
@ -292,6 +292,4 @@ interface NetworkSession{
|
||||
public function handleStopSound(StopSoundPacket $packet) : bool;
|
||||
|
||||
public function handleSetTitle(SetTitlePacket $packet) : bool;
|
||||
|
||||
public function handleUnknown(UnknownPacket $packet) : bool;
|
||||
}
|
@ -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(){
|
||||
|
@ -37,6 +37,10 @@ class UnknownPacket extends DataPacket{
|
||||
return self::NETWORK_ID;
|
||||
}
|
||||
|
||||
public function getName() : string{
|
||||
return "unknown packet";
|
||||
}
|
||||
|
||||
public function decode(){
|
||||
$this->offset -= 1; //Rewind one byte so we can read the PID
|
||||
$this->payload = $this->get(true);
|
||||
@ -48,6 +52,6 @@ class UnknownPacket extends DataPacket{
|
||||
}
|
||||
|
||||
public function handle(NetworkSession $session) : bool{
|
||||
return $session->handleUnknown($this);
|
||||
return false;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user