I have a attempt for this butit failed, and i dont know whats going on. I search for this problem around the internet, but i still didnt get it here's my code PHP: public function onInventoryTransaction(InventoryTransactionEvent $event){ $transaction = $event->getTransaction(); $player = $transaction->getSource(); $action = $transaction->getActions(); if($action instanceof SlotChangeAction){ $event->setCancelled(); } } sorry if my code was bad, cuz am new hehe
Based off what I can see getActions() returns an array of actions, so checking if an array is an instance of SlotChangeAction will always result in false. You can var_dump($action) to see what it is and how to achieve your goal
so how's var_dump do and how can i use it? also, can i use other method to achieve my goal than this? so if i failed i can use other method
ups i was fixing my own problem UwU PHP: public function noInvMove(InventoryTransactionEvent $event){ if($this->getServer()->getLevelByName("world")->getPlayers()){ $event->setCancelled(); } } UwU, well i didnt even expain all in the thried yet but ok UwU