Solved Inventory Spot

Discussion in 'Bukkit Help' started by bubblefat_, May 25, 2015.

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

    bubblefat_

    How to I set the spot of an item in the inventory?

    Here is my code

    Code:
        public static Inventory getStarInventory() {
       
            Inventory inv = Bukkit.createInventory(null, 27, "§lSelect your Kit!");
           
            {
                ItemStack item = new ItemStack(Material.ANVIL, 1);
                ItemMeta meta = item.getItemMeta();
                meta.setDisplayName(ChatColor.GREEN + "§lPlayer Kits");
                List<String> lore = new ArrayList<String>();
                lore.add("§7These are all the player kits that you get from");
                lore.add("§7joining the server!");
                lore.add(" ");
                lore.add("§cYou can't add green wool like normal,");
                lore.add("§conce I know how I will change to green wool");
                meta.setLore(lore);
                item.setItemMeta(meta);
                inv.addItem(item);
                   
            }
           
           
            {
                ItemStack item = new ItemStack(Material.IRON_CHESTPLATE, 1);
                ItemMeta meta = item.getItemMeta();
                meta.setDisplayName(ChatColor.GREEN + "§lKnight");
                List<String> lore = new ArrayList<String>();
                lore.add("§7The Knight is the classic Minecraft warrior. He doesn't");
                lore.add("§7have any special abilities, although he has generally");
                lore.add("§7better armour then other players and more health!");
                meta.setLore(lore);
                item.setItemMeta(meta);
                inv.addItem(item);
                   
            }
           
            {
                ItemStack item = new ItemStack(Material.AIR, 1);
                inv.addItem(item);
                   
            }
           
            {
                ItemStack item = new ItemStack(Material.DIAMOND_SWORD, 1);
                ItemMeta meta = item.getItemMeta();
                meta.setDisplayName(ChatColor.GREEN + "§lAssassin");
                List<String> lore = new ArrayList<String>();
                lore.add("§7The assassin is a very strong in strength, although he");
                lore.add("§7has one weakness: He has bad armor! Fortunately for him");
                lore.add("§7his strength makes up for it");
                meta.setLore(lore);
                item.setItemMeta(meta);
                inv.addItem(item);
                   
            }
           
            return inv;
        }
       
        public static Location getTarget(){
            return targetPoint;
        }
       
        public static void setTarget(Location loc) {
            Main.targetPoint=loc;
        }
     
  2. Offline

    oceantheskatr

    inv.setItem(<slot>, item);
     
  3. Offline

    bubblefat_

    Now I feel stupid, thanks.
     
  4. Offline

    oceantheskatr

    @bubblefat_ No worries! Easy to overlook things sometimes :p
     
    Markyroson likes this.
Thread Status:
Not open for further replies.

Share This Page