GUI Question?

Discussion in 'Plugin Development' started by Aephout14, Feb 24, 2015.

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

    Aephout14

    I am making a GUI type plugin, I need to have items put in Seperate areas of the gui like, the 32 slot is a piece of dirt and the 34 is grass, No other items in the gui, If someone could help me that would be appreciated.
     
  2. Offline

    teej107

  3. Offline

    anson023

    What does your GUI mean..
    chest?..
     
  4. Offline

    Aephout14

  5. Offline

    anson023

    I don't know
    maybe clicking from chat
    and maybe this is you want
    Code:
    public class GUI extends JavaPlugin implements Listener {
        public static Inventory myInventory = Bukkit.createInventory(
        null , 9 , ChatColor.BLACK + "GUI");
    static {
            myInventory.setItem(0,item01);
            myInventory.setItem(1,item02);
        }
    @EventHandler
    public void onInventoryClick(InventoryClickEvent e) {
        Player p = (Player) e.getWhoClicked();
        Inventory inventory = e.getInventory();
        if(inventory.getName().equals(myInventory.getName())){
            if(e.getClick()==ClickType.RIGHT || e.getClick()==ClickType.LEFT) {
                e.setCancelled(true);
                if(e.getCurrentItem().equals(item01)){
                    p.performCommand("");
                }
                if(e.getCurrentItem().equals(item02)){
                    p.performCommand("");
                }
            }
        }
    }
    public boolean onCommand(CommandSender sender , Command cmd , String lable , String[] args) {
    if(lable.equalsIgnoreCase("gui")){
        Player p = (Player) sender;
        p.openInventory(myInventory);
    }
    }
    }
     
Thread Status:
Not open for further replies.

Share This Page