hello, I have an error that tells me "Undefined property: stdClass::$entityRuntimeId " but I dont know how to solve this problem. PHP: /** * @param DataPacketReceiveEvent $event * @return bool */ public function onPacketReceived(DataPacketReceiveEvent $event) { $pk = $event->getPacket(); if ($pk instanceof InventoryTransactionPacket) { (isset($this->entity[$pk->trData->entityRuntimeId])){ $citizen = $this->entity[$pk->trData->entityRuntimeId]; if (!isset($this->command[$event->getPlayer()->getName()])) { $citizen->commandExecute($event->getPlayer()); return true; } } } }
The error answers your question. According to https://github.com/pmmp/PocketMine-.../mcpe/protocol/InventoryTransactionPacket.php, InventoryTransactionPacket::$trData->entityRuntimeId is set only if InventoryTransactionPacket::$transactionType returns InventoryTransactionPacket::TYPE_USE_ITEM_ON_ENTITY. So you'll need to check that before calling trData->entityRuntimeId.