InventoryTransactionEvent can refer to transactions between two inventories. For example, if hoppers are implemented, sucking an item from a chest to a hopper is also a transaction. Therefore, first thing you need to do is to check if the event is a player-chest event: PHP: $transactions = $InventoryTransactionEvent->getTransactions()->getTransactions();foreach($transactions as $tr){ if($tr->getInventory() instanceof ChestInventory){ $chestTran = $tr; }elseif($tr->getInventory() instanceof PlayerInventory){ $playerTran = $tr; }}if(!isset($chestTran) or !isset($playerTran)) return; Now, to know if it is chest-to-player or player-to-chest, either check the player inventory increase/decrease or chest inventory increase/decrease: PHP: $chestToPlayer = $chestTran->getTargetItem()->getCount() < $chestTran->getSourceItem()->getCount(); Check the source item of the source transaction, or the target item of the target transaction, to find out the item type. Use the minus operator to find out how many items have been transacted. Note that if the transaction involves more than one slot (e.g. if the target slot is full), my method would malfunction. You would have to add up every transaction.
I am sorry for bumping this, but the solution sounds good. Could i even use transaction->getInventories()?
Typo in the first line $transactions = $InventoryTransactionEvent->getTransaction()->getTransactions(); //first transaction then transactionssssss