InventoryClickEvent Not Working?

Discussion in 'Plugin Development' started by MrTwiggy, Jan 29, 2013.

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

    MrTwiggy

    Hey there, I'm in need of a bit of help. I have an InventoryClickEvent, which works perfectly fine with all normal inventories (player inventory, chests, furnaces, crafting table). I have a console message being sent every time the event is fired to see when it is and isn't fired.

    However, if I open a custom inventory for the player, similar to something like this:

    Inventory inv = Bukkit.getServer().createInventory(PLAYER, 27, "Name");
    PLAYER.openInventory(inv);

    If the player clicks in the custom inventory, it won't call the InventoryClickEvent, even if they are clicking on items in their own personal inventory, and not in the attached 'custom' inventory I created.

    Any ideas?

    EDIT SOLUTION:

    Don't ask me why or how, but after some tinkering, it seems that adding a 1 tick delay before opening the inventory fixed the inventoryClickEvent problem. However, when closing the inventory, it won't fire the InventoryCloseEvent, but oh well, I'll make due.
     
  2. Offline

    DJSanderrr

    Post the "console message" and more code
     
  3. Offline

    MrTwiggy

    The console message was just 'INVENTORY CLICKED IN' and there wasn't really more code. But I found out a solution that I posted in the OP.
     
  4. Offline

    DJSanderrr

    Okay!
    If your post is solved, set the Thread prefix to Solved.

    And btw, how u added a delay? :$ i still don't know that
     
Thread Status:
Not open for further replies.

Share This Page