How can I get the Item that's being transacted between Inventories I need to check if the player takes the right Item from Another Inventory. This doesn't seem to work: PHP: $transactions = $ev->getTransaction()->getTransactions(); foreach($transactions as $transaction){ $inv = $transaction->getInventory(); if($inv instanceof PlayerInventory){ foreach($inv->getViewers() as $assumed) { if ($assumed instanceof Player) { //getTargetItem() just produces an ERROR. $this->getServer()->getLogger()->info($inv->getTargetItem()->getId()); } } } } Nor: PHP: $item = $ev->getTransaction()->getInventories()->getItem(); // Of Course getItem() needs an index. I already know that, But I still tested it.$this->getServer()->getLogger()->info("ID: " . $item->getId()); Help is ALWAYS Appreciated. Note: I already added PHP: use pocketmine\inventory\PlayerInventory;
Code: CRITICAL> "Could not pass event 'pocketmine\event\inventory\InventoryTransactionEvent' to 'GUICombiner v1.0.0': Call to undefined method pocketmine\inventory\PlayerInventory::getTargetItem() on CortexPE\TridentNetwork\GUICombiner CRITICAL> Error: "Call to undefined method pocketmine\inventory\PlayerInventory::getTargetItem()" (EXCEPTION) in "/plugins/GUICombiner_v1.0.0/src/CortexPE/TridentNetwork/GUICombiner" at line 135
The error is pretty self explanatory. You used PlayerInventory->getTargetItem(), which doesn't exist. This function does, though.
Tried this: http://forums.pocketmine.net/threads/get-item-inventorytransactionevent.15350/#post-149353 but It also didn't work for me...