use pocketmine\network\mcpe\NetworkSession; class PlayerActionPacket extends DataPacket{ const NETWORK_ID = ProtocolInfo::PLAYER_ACTION_PACKET; const ACTION_START_BREAK = 0; const ACTION_ABORT_BREAK = 1; const ACTION_STOP_BREAK = 2; const ACTION_RELEASE_ITEM = 5; const ACTION_STOP_SLEEPING = 6; const ACTION_RESPAWN = 7; const ACTION_JUMP = 8; const ACTION_START_SPRINT = 9; const ACTION_STOP_SPRINT = 10; const ACTION_START_SNEAK = 11; const ACTION_STOP_SNEAK = 12; const ACTION_DIMENSION_CHANGE = 13; //TODO: correct these const ACTION_START_GLIDE = 15; const ACTION_STOP_GLIDE = 16; const ACTION_BUILD_DENIED = 17; const ACTION_CONTINUE_BREAK = 18; public $entityRuntimeId; public $action; public $x; public $y; public $z; public $face; public function decode(){ $this->entityRuntimeId = $this->getEntityRuntimeId(); $this->action = $this->getVarInt(); $this->getBlockPosition($this->x, $this->y, $this->z); $this->face = $this->getVarInt(); } public function encode(){ $this->reset(); $this->putEntityRuntimeId($this->entityRuntimeId); $this->putVarInt($this->action); $this->putBlockPosition($this->x, $this->y, $this->z); $this->putVarInt($this->face); } public function handle(NetworkSession $session) : bool{ return $session->handlePlayerAction($this); } }