Minecraft – How to disable opening inventories in minecraft

minecraft-commandsminecraft-java-edition

So I've been working on my map for a while, and its a custom pvp game kinda thing. There, I want all the players to be unable to access their inventories because it might cause some errors, as in my minigame there are different classes with different skills etc. How do I do that?

Best Answer

If you are a developer you can look further into cancelling the OpenInventoryEvent, it would look something like this, with a little editing of course. Or you can look into premade code such as RegionInventoryBlocker.

    @EventHandler(priority = EventPriority.NORMAL)
public void onInventoryOpen(InventoryOpenEvent event)
{
    event.setCancelled(true);
}

If you are a regular user, you can use a plugin such as http://mods.curse.com/bukkit-plugins/minecraft/lobbytools to disable the movement of things around on your inventory, this should do the job. You can also look into many other plugins that do this job.

Other than that, there is no other known way to completely disable the inventory.