Why won't this block users from moving items in an inventory?

Discussion in 'Spigot Plugin Development' started by Azmidium, Mar 13, 2016.

  1. Okay, so I made a plugin where you get an elytra when you join, it is supposed to also make it so you can't remove ANYTHING in the armor slots.

    So in survival mode it works: Click here to view
    In creative mode the issue occurs: Click here to view

    Even though this is the lobby, no players are gonna get creative, but why is this happening?

    Here is my code:

    Code (Text):

        @EventHandler
        public void inventoryClick(InventoryClickEvent e) {
            if (e.getWhoClicked().getWorld().getName().equalsIgnoreCase(plugin.getConfig().getString("hub-world"))) {
                if (e.getSlotType() == SlotType.ARMOR) {
                    e.setCancelled(true);
                }
            }
        }
    I am still looking for a reason, I cancel the event if the slot you click on is an armor slot, I am pretty sure what I clicked in creative mode was armor slots.

    Is this an issue with Spigot 1.9, my code, or the server? We tested this with 5 bar connection, but who knows.
     
  2. I think it is just simply because they are in creative...