use pocketmine\network\mcpe\NetworkSession; class SetSpawnPositionPacket extends DataPacket{ const NETWORK_ID = ProtocolInfo::SET_SPAWN_POSITION_PACKET; const TYPE_PLAYER_SPAWN = 0; const TYPE_WORLD_SPAWN = 1; /** @var int */ public $spawnType; /** @var int */ public $x; /** @var int */ public $y; /** @var int */ public $z; /** @var bool */ public $spawnForced; protected function decodePayload(){ $this->spawnType = $this->getVarInt(); $this->getBlockPosition($this->x, $this->y, $this->z); $this->spawnForced = $this->getBool(); } protected function encodePayload(){ $this->putVarInt($this->spawnType); $this->putBlockPosition($this->x, $this->y, $this->z); $this->putBool($this->spawnForced); } public function handle(NetworkSession $session) : bool{ return $session->handleSetSpawnPosition($this); } }