Get Colored Leather Armor

Discussion in 'Plugin Development' started by derHummlerLP, Nov 30, 2016.

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

    derHummlerLP

    First:
    Sorry for my bad English, i'm german.

    "ItemStack Brust = new ItemStack(Material.LEATHER_CHESTPLATE);
    ItemMeta BrustMeta = Brust.getItemMeta();
    BrustMeta.setDisplayName("§9BuilderChestplate");
    BrustLore.remove("§7Test");
    BrustLore.add("§7Test");
    GunpowderMeta.setLore(BrustLore);
    Brust.setItemMeta(BrustMeta);"


    now my Question:
    Where must I put the command for decimal colored Leatherarmor and what exactly is the command?

    Thanks

    PS: Wrote in Eclipse
     
  2. Offline

    BeastyBoo

    @derHummlerLP
    Code:
    BrustMeta.setColor(Color.fromRGB(255, 0, 0));
    the first parameter in the fromRGB method is red color second in green and third is blue, if you play with it a bit you could get pretty much all the colors :)
     
  3. Offline

    derHummlerLP

    I knew trat already, but Ellipse every time underlines it in Red, so the plugin dont Works. :(
     
  4. Offline

    ipodtouch0218

    @derHummlerLP
    Could you give us the error that appears when you hover your mouse over the underlined word?
     
  5. Offline

    derHummlerLP

    it says "The method setColor(Color) is undefined for the type ItemMeta". should I click "Add cast to BrustMeta"?
     
  6. Online

    timtower Administrator Administrator Moderator

  7. Offline

    derHummlerLP

    Anybody here who can explain that in easy english? :D You may remind, im German
     
  8. Offline

    Wispyy

    @derHummlerLP
    Leather armour has a different meta. To set the colour you need to change it to LeatherArmorMeta and call setColor(color) on it. For example:
    Code:java
    1.  
    2. BrustMeta.setColor(color);
    3.  
     
  9. Offline

    DuaneTheDev_

    For basic example;

    Define the wanted color;
    Code:
    Color c = Color.fromRPG(0,1,43);
    Then create the LeatherArmorMeta
    Code:
    LeatherArmorMeta meta = (LeatherArmorMeta) Brust.getItemMeta(); 
    And finally set the color, and assign Meta to the itemstack
    Code:
    meta.setColor(c);
           Brust.setItemMeta(meta);


    Should work, if not... I'm dumb.
     
  10. Offline

    Lordloss

Thread Status:
Not open for further replies.

Share This Page