InventoryClickEvent doesn´t fire?

Discussion in 'Spigot Plugin Development' started by ExoBiTe, Apr 19, 2017.

  1. Hey
    while writing a Shop Plugin, i think i encountered an error.
    The InventoryClickEvent doesn´t fire on every Inventory Click.

    http://i.imgur.com/XwnDZo9.mp4

    Here´s a gif, where you can see a message in the chat upon every click. But as i opened the chest, i made it to place two items (the snow and the grass block) in the chest where the Plugin just detected 2 clicks (but there were 4).
    Here´s the code for the event:
    Code (Text):
        @EventHandler
        public void invClick(InventoryClickEvent e){
            e.getWhoClicked().sendMessage("Inv :"+e.getClickedInventory().getName()+", slot: "+e.getSlot());
        }
    Is it just me (am i overseeing something) or why doesn´t the event fire on every click?
     
    #1 ExoBiTe, Apr 19, 2017
    Last edited: Apr 19, 2017
  2. I believe this is caused by the fact that when a player is in creative, their inventory works differently. The client notably has the "right" to modify the inventory on their own, without the need of the server's "approval". If you need support for players in creative I suggest you try
    InventoryCreativeEvent. Otherwise just try to do the same experiment in survival.
     
  3. What do you mean? Have you registered the event?
     
  4. I hoped you were right, but sadly the same thing happens in every game mode. :/

    Yes. If i wouldn´t have registered it, i would never get a message.
     
  5. I thought this is from another event - sorry ;)