use pocketmine\network\mcpe\NetworkSession; class SetDisplayObjectivePacket extends DataPacket{ public const NETWORK_ID = ProtocolInfo::SET_DISPLAY_OBJECTIVE_PACKET; public const DISPLAY_SLOT_LIST = "list"; public const DISPLAY_SLOT_SIDEBAR = "sidebar"; public const DISPLAY_SLOT_BELOW_NAME = "belowname"; public const SORT_ORDER_ASCENDING = 0; public const SORT_ORDER_DESCENDING = 1; /** @var string */ public $displaySlot; /** @var string */ public $objectiveName; /** @var string */ public $displayName; /** @var string */ public $criteriaName; /** @var int */ public $sortOrder; protected function decodePayload(){ $this->displaySlot = $this->getString(); $this->objectiveName = $this->getString(); $this->displayName = $this->getString(); $this->criteriaName = $this->getString(); $this->sortOrder = $this->getVarInt(); } protected function encodePayload(){ $this->putString($this->displaySlot); $this->putString($this->objectiveName); $this->putString($this->displayName); $this->putString($this->criteriaName); $this->putVarInt($this->sortOrder); } public function handle(NetworkSession $session) : bool{ return $session->handleSetDisplayObjective($this); } }