Solved Help with How to set Lore :D

Discussion in 'Spigot Plugin Development' started by WaffleMast3r, Jun 3, 2017.

Thread Status:
Not open for further replies.
  1. That is my function who creates the item and add it to an inventory
    Code (Text):

    @SuppressWarnings("deprecation")
        public void metaitm(Player player, Material material,int matid, int id, Inventory inv, int Slot, String name, ArrayList<String> Lore){
            ItemStack item;
            if (material == null && matid != 0){
                item = new ItemStack(matid, 1, (short)id);
            }else{
                item = new ItemStack(material, 1, (short)id);
            }
            ItemMeta meta = item.getItemMeta();
            meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', name));
            if(Lore != null){
                ArrayList<String> LoreM = new ArrayList<String>();
                for(String lore:Lore){
                    LoreM.add(ChatColor.translateAlternateColorCodes('&', lore));
                }
                meta.setLore(LoreM);
            }
            item.setItemMeta(meta);
             
            inv.setItem(Slot, item);
           
            player.openInventory(inv);
        }
     
    When call the function I type this:

    ArrayList<String> lorevanzari = (ArrayList<String>) getConfig().get("lorevanzari");

    metaitm(player, Material.BOOK_AND_QUILL, 0, 0, infinv, 10, "&4"+LeftArrow+"&7Vanzari&4"+RightArrow, lorevanzari);

    and in config I have this:
    loredetalii:
    - "&7da"
    - "&anu"

    and when I go in mc the inventory looks like this:
    http://prntscr.com/ffeo6d

    And the lore is not colored !
    Please help me to fix that!
     
  2. Is lore an ArrayList?
     
  3. You are getting a different list from the config file.
     
  4. i get the lore 3 times for 3 diferent items :
    lorevanzari:
    - "&ada"
    - "&6nu"
    loretransferuri:
    - "&ada"
    - "&6nu"
    loredetalii:
    - "&ada"
    - "&6nu"
     
  5. Nevermid i fix it some how Thank u Guys :D
     
Thread Status:
Not open for further replies.