Most efficient way to do this would be to cancel InventoryOpenEvent PHP: public function onInventoryOpen(InventoryOpenEvent $event) { if($event->getInventory() instanceof ChestInventory) { $event->setCancelled(); }}
You can also try cancelling the PlayerInteractEvent! PHP: public function onInteract(PlayerInteractEvent $event) { if($event->getBlock()->getId() === Block::CHEST) { $event->setCancelled(); }}
That would also work, but will get triggered more unnecessarily. Not all interaction events results in chest being open.
Wait, but wouldn't that get triggered for enderchests too? Or is there a separate inventory for enderchests?