Solved Leather Color ItemStack Meta

Discussion in 'Spigot Plugin Development' started by Marshmalah, Jan 22, 2020.

Thread Status:
Not open for further replies.
  1. Hey, I would like to know if it is possible to add a predefined color with the GRB code for example # 03fc88 to this weave please?
    I can't use #setColor don't work in my code

    Code (Java):
                ItemStack c5 = new ItemStack(Material.LEATHER_LEGGINGS);
                ItemMeta c5M = c5.getItemMeta();
                c5M.setColor(Color.BLUE);
                c5M.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
                if(p.hasPermission("forgeron.recette.apprenti.19")) {
                    c5M.setDisplayName(ChatColor.WHITE + "Recette : Jambières en Cuivre");
                    if(lvl >= 35)
                    {
                        c5M.setLore(Arrays.asList(ChatColor.GRAY+"Type : "+ChatColor.WHITE+"Jambes",ChatColor.GREEN+"Déjà Connue"));  
                    }else
                    {
                        c5M.setLore(Arrays.asList(ChatColor.GRAY+"Type : "+ChatColor.WHITE+"Jambes",ChatColor.YELLOW + "Augmente la compétence de 0 - 35",ChatColor.GREEN+"Déjà Connue"));
                    }
                }else
                {
                    c5M.setDisplayName(ChatColor.WHITE + "Achat - Recette : Jambières en Cuivre");
                    c5M.setLore(Arrays.asList(ChatColor.GRAY+"Type : "+ChatColor.WHITE+"Jambes",ChatColor.YELLOW + "Compétence Requis : 25",ChatColor.RED + "Prix : 1000$",ChatColor.RED+"Inconnue"));  
                }
                c5.setItemMeta(c5M);
    Thanks for watching ;)
     
  2. You can try like that
    Code (Java):

     LeatherArmorMeta meta = (LeatherArmorMeta) c5.getItemMeta();
      meta.setColor(Color.fromRGB(red,green,blue));
      c5.setItemMeta(meta);
     
     
    • Agree Agree x 1
  3. Thanks
     
  4. Please mark this thread as solved if you have no further issues so other people don't think you need any further help.
     
Thread Status:
Not open for further replies.