Hey guys, JBoss925 here. I just want to block people from opening their inventories if they're in the game array list. I have the rest of them game working and know they are added to the array list. I also know I have registered my events. Here's my code for it: Code:java @EventHandler public void onOpenInventory(InventoryOpenEvent e){ if(game.contains(e.getPlayer().getUniqueId())){ e.setCancelled(true); e.getPlayer().closeInventory(); } } Any help as to why this isn't working is appreciated!
Then could I do: Code:java @EventHandler public void onInventoryClick(InventoryClickEvent e){ if(game.contains(e.getWhoClicked().getUniqueId())){ e.setCancelled(true); } } ? I just don't want them to be able to move stuff around.
Instead of closing the inventory right away I think you need to wait one tick. Also, don't cancel the event.
AstramG Wouldn't work, regardless. The client doesn't send anything to the server if a player opens their own inventory.