use pocketmine\network\mcpe\handler\PacketHandler; use function count; class PurchaseReceiptPacket extends DataPacket implements ServerboundPacket{ public const NETWORK_ID = ProtocolInfo::PURCHASE_RECEIPT_PACKET; /** @var string[] */ public $entries = []; protected function decodePayload() : void{ $count = $this->getUnsignedVarInt(); for($i = 0; $i < $count; ++$i){ $this->entries[] = $this->getString(); } } protected function encodePayload() : void{ $this->putUnsignedVarInt(count($this->entries)); foreach($this->entries as $entry){ $this->putString($entry); } } public function handle(PacketHandler $handler) : bool{ return $handler->handlePurchaseReceipt($this); } }