Thank you all Can anyone tell me why this isnt working? Code:java @EventHandler public void onClick(InventoryClickEvent e){ if(e.getSlotType() == SlotType.ARMOR){ if(e.getSlot() == 103){ e.setCancelled(true); } } } EDIT by Moderator: merged posts, please use the edit button instead of double posting.
Not working? How so? An error? Or it just doesn't cancel? Add debug messages to see if it makes it past the the conditionals. You shouldn't need the SlotType.ARMOR check.
The event is registered, I added a system.out.println to check, What do you mean e.getSlot() isnt null?
sgavster Integer can't be null. Assult You said you added a debug line, how far did it go? Also try printing out the slot.
Code: if (e.getSlotType().equals(slotnumber) && !e.getCurrentItem().getType().equals(Material.AIR)) {