InventoryCloseEvent Not working properly

Discussion in 'Spigot Plugin Development' started by dyenxunit, Jun 30, 2015.

Thread Status:
Not open for further replies.
  1. Hi, so i ran into a small problem with the inventory close event and that problem is when i close my inventory kits and open up kit special it removes the player from a arraylist when it opens instead of removing the player when the player closes kit special. How do i prevent this?

    Code (Text):

    @EventHandler
        public void onClose(InventoryCloseEvent e) {
            final Player p = (Player) e.getPlayer();
    if(e.getInventory().getTitle().equals("Kit Special")) {
    if(kitspecial.contains(p.getName())){
                p.sendMessage("Test");
                kitspecial.remove(p.getName());
                }
    }
    }
    }
     
    #1 dyenxunit, Jun 30, 2015
    Last edited: Jun 30, 2015
  2. That formating :eek:

    I'd imagine you might be removing them from the list when the inventory kits closes.

    I doubt its the code you've shown us because that would only be called when the inventory named "Kit Special" closes.
     
  3. this is the code i have setup and i have tested it when the other inv closes it removes them instead of removing them when they close Kit Special
     
  4. Its actually cancelling it when it opens the inventory as i tested it
     
Thread Status:
Not open for further replies.