Solved GUI Being a Twat

Discussion in 'Plugin Development' started by DogeDebugger, May 18, 2015.

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

    DogeDebugger

    Used this resource: https://bukkit.org/threads/tutorial-create-a-inventory-menu.173571/

    So I have this:
    Code:
    @EventHandler
        public void openShops(InventoryClickEvent event) {
            final Player p = (Player) event.getWhoClicked();
            final ItemStack i = event.getCurrentItem();
            if(i.getItemMeta() != null)
                if(i.getItemMeta().getDisplayName().equals(ChatColor.AQUA + "Weapon Shop")) {
                p.sendMessage("y");
                p.openInventory(WeaponShop.weaponshop);
            } else {
                p.sendMessage("n");
            }
        }
    I do get sent the "y" message, so im clicking the right thing, but when i click it, it just exits out and doesn't do anything.

    WeaponShop:
    Code:
    import org.bukkit.Bukkit;
    import org.bukkit.ChatColor;
    import org.bukkit.Material;
    import org.bukkit.enchantments.Enchantment;
    import org.bukkit.inventory.Inventory;
    import org.bukkit.inventory.ItemStack;
    
    public class WeaponShop {
    
        public static Inventory weaponshop = Bukkit.createInventory(null, 9, "Weapon Shop");
       
        public static ItemStack stonesword = new ItemStack(Material.STONE_SWORD, 1);
        public static ItemStack ironsword = new ItemStack(Material.IRON_SWORD, 1);
        public static ItemStack escrima = new ItemStack(Material.BLAZE_ROD, 1);
    
        static {
            stonesword.getItemMeta().setDisplayName(ChatColor.AQUA + "Stone Sword");
            ironsword.getItemMeta().setDisplayName(ChatColor.AQUA + "Iron Sword");
            escrima.getItemMeta().setDisplayName(ChatColor.YELLOW + "Escrima Stick");
            escrima.addUnsafeEnchantment(Enchantment.KNOCKBACK, 3);
            escrima.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 4);
           
            weaponshop.setItem(0, stonesword);
            weaponshop.setItem(1, ironsword);
            weaponshop.setItem(2, escrima);
        }
       
    }
    
     
    jthort likes this.
  2. Offline

    DogeDebugger

    solved

    u unresponsive scroobs :p jk
     
    Last edited: May 19, 2015
    seanliam2000 likes this.
  3. @DogeDebugger This is one of the best titles I have seen in a long time :D
     
    DogeDebugger likes this.
  4. Offline

    Reynergodoy

    i think thats because.... you're not right clicking it properly, it should be player interact event '-'
     
  5. Offline

    DogeDebugger

    solved lmao
     
Thread Status:
Not open for further replies.

Share This Page