Can't Cancel Inventory Clicks?

Discussion in 'Plugin Development' started by baighxansgaming, Dec 5, 2016.

Thread Status:
Not open for further replies.
  1. Offline

    baighxansgaming

    I'm using this with a GUI, and it's not working. I thought it used to work.... What changed?
    Code:
    @EventHandler
        public void onClick(InventoryClickEvent e) {
            if (e.getInventory().getName().equalsIgnoreCase(inv.getName())) {
                e.setCancelled(true);
            }
        }
     
  2. Offline

    Zombie_Striker

    @baighxansgaming
    Print out the name of the "clicked" inventory and the name of the "inv" inventory. For the event to not actually be canceled, those names have to be different.
     
  3. Offline

    renaud444

    Try instead of using the inventory given by the event, to see if the player's open inventory (e.getPlayer().getOpenInventory() ? ) has the same name. Also, do print the inventory names just to be safe, there could be small unseen differences.
     
Thread Status:
Not open for further replies.

Share This Page