PHP: public function onTransaction(InventoryTransactionEvent $event){ $transactions = $event->getTransaction()->getActions(); $player = $event->getTransaction()->getSource(); $action = null; foreach($transactions as $transaction){ $action = $transaction; break; } if($action === null) return; if($action instanceof ItemDropAction) return; // don't copy paste ;) $itemTaken = $action->getSourceItem(); //item a player took from the inventory $itemGiven = $action->getTargetItem(); //item a player placed in the inventory //code} NOTE: Use this code only if you are using the 1.2 branch!
There is, but it's more complex. Maybe look into a Player Vaults plugin on github. It can be very helpful for understanding how to track inventory transactions