Inventory Listener Problem

Discussion in 'Plugin Development' started by ElliottOlson, Aug 4, 2014.

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

    ElliottOlson

    Hello Users of BukkitDev,

    I was wondering about a bug I found while testing a new version of a plugin I am going to upload to BukkitDev. The bug is as follows:
    I open a inventory by executing a command, from that inventory I am able to click a arrow to view page one, and then click a return arrow to return to the first page. Everything functions perfectly until this point, when I return back to the original inventory, the listener is not functioning. I am then able to move the objects, and I cannot click a item to select that effect.

    Does anybody know why the listener wouldn't work after returning back to the original inventory.

    Thank you for helping.
     
  2. Offline

    Skye

    ElliottOlson Could be anything, like calling Player.closeInventory from an InventoryClickEvent and immediately opening a new one. But there's no way to give a definitive answer if you don't paste your source.
     
  3. Offline

    ElliottOlson

    Skye I am using the p.closeInventory() and then calling InventoryUtil.showInventory(p); I don't believe this is the problem however because it functions properly for the second inventory.

    Do you believe it is necessary to post source code to fix this issue?
     
  4. Offline

    Skye

    ElliottOlson It might not be the problem, but you should know it's an unsafe method to call from that event.

    How can we debug code we can't see? There are countless logic errors you could have made for your plugin to behave that way.
     
  5. Offline

    fireblast709

    ElliottOlson well as Skye mentioned, closing and opening is a bit buggy. Schedule a 0 tick delayed task that closes the inventory (just use the runTask method), then in that task, open the new inventory with a 0 tick delayed task.
     
Thread Status:
Not open for further replies.

Share This Page