Solved Inventory Gui

Discussion in 'Plugin Development' started by Tdarnell, Jun 14, 2013.

Thread Status:
Not open for further replies.
  1. Ok so I'm having a problem with my newest bukkit project.
    So far my code creates an inventory using bukkits default method and names it ("Primal Menu " + p.getName())
    The problem is this menu has two items in it, and when they are clicked I want to open an entierly different inventory, however currently when they are clicked it does not work properly. The method I use right now is to create a new inventory when the item is clicked, whilst the old one is open.

    I then have the plugin check if a player interacts with items in the second inventory, but this bits not working. I'm not quite sure why. in game the inventory opens, then the second one opens seemingly as it should, but when I click one of the items in it I can pick it up and none of the comands it should run work.

    I currently check for inventory click events, and I check it is the right inventory using getTitle(), I have also tried getName(), neither works.

    The new inventorys created have a different name to the initial one, so they are Games menu ect.
    I do not close the initial inventory first, as if I do, the second one does not open at all.
    my only solution I have come up with is to close it then use schedulers to open the new one a few seconds after, but I hate schedulers, and don't want to delay the event at all.

    If you need more information or want to see the problem first hand, I can open up my testing server to you quickly. all help is appreciated :)
  2. Offline


    may you show your code?
  3. Edit: problem solved
  4. this:
  5. A way that is much cleaner as yourse I guess...
  6. I find it easier with my method, but that doesn't make a difference, my problem is not making an inventory, I've used that method before and found it harder to have two inventorys using it, so I re-coded it in a more messy but easy to edit format.
  7. Offline


    You should not open or close inventories from the InventoryClickEvent. Use the scheduler to add a 1 tick delay.

  8. Could you help me with that, I hate using schedulers and generally avoid them because they cause severe errors for me usually on server start up :L they are my kryptonite.

    solved using schedulers. Thanks.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Jun 2, 2016
Thread Status:
Not open for further replies.

Share This Page