Solved How dose one create a gui within a gui?

Discussion in 'Plugin Development' started by McKiller5252, Dec 31, 2013.

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

    McKiller5252

    So i want to create another gui when i click a icon as shown here
    [​IMG]

    but i am having some trouble figuring how to do that :p
    Today is my first time creating a solo bukkit plugin but i do know java for 3 years now, I am just used to making mods :p

    Could one of you kindly help me add another gui?
    Here is the code so far for when you click on the icon it switches to the new GUI

    Code:java
    1.  
    2. @EventHandler
    3. public void onInventoryClick(InventoryClickEvent e){
    4. if (!e.getInventory().getName().equalsIgnoreCase(inv.getName())) return;
    5. if (e.getCurrentItem().getItemMeta()== null) return;
    6.  
    7. if (e.getCurrentItem().getItemMeta().getDisplayName().contains("Firework List"))
    8. {
    9. e.setCancelled(true);
    10.  
    11. e.getWhoClicked().closeInventory();
    12. }
    13.  
    14. }
    15.  


    Thank you kindly for the help if you decide to :)
     
  2. Offline

    Not2EXceL

    Close current gui and open new one.
     
  3. Offline

    McKiller5252

    How would the code look like with mine?
     
  4. Offline

    Gater12

    McKiller5252 Inception. You would just open the inventory to the player???
     
  5. Offline

    McKiller5252

    So something like

    e.getWhoClicked().openInventory()
     
  6. Offline

    Gater12

  7. Offline

    McKiller5252

    Let me try it and see if it work.

    Oh damn it did work :D
    [​IMG]


    but i need to add a small time delay on when pressing the icon to open this gui

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 6, 2016
  8. Offline

    Gater12

    McKiller5252 You can use scheduleSyncDelayedTask or runTaskLater
     
  9. Offline

    McKiller5252

    Thank you so much for the help :)
     
    Gater12 likes this.
Thread Status:
Not open for further replies.

Share This Page