or you can use: PHP: public function onDrop(PlayerDropItemEvent $event) { if ($event->getItem() instanceof ArmorInventory) { $event->setCancelled(true); }}
I tried that but it don't worked PHP: public function onTransActionEvent(InventoryTransactionEvent $event) { if ($event->getItem() instanceof ArmorInventory) { $event->setCancelled(true); }} }
open your eyes, i said that in the second post in thread. also its working but its a glitch in w10 edition, players can drop with ctrl+click but in transactioninv they can drop armor anyway.
PHP: public function onTransaction(\pocketmine\event\inventory\InventoryTransactionEvent $event) { foreach ($event->getTransaction()->getInventories() as $inventory) { if($inventory instanceof \pocketmine\inventory\ArmorInventory) { $event->setCancelled(); break; } }} Don't forget to register listener The code will block setting armor too.