Solved Colored leather armor?

Discussion in 'Plugin Development' started by Ibix13, May 17, 2013.

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

    Ibix13

    I need to know how I can make leather armor a color when giving it to player :p
    help pl0x
     
  2. Offline

    caseif

  3. Offline

    Ibix13

  4. Seriously? Is your English that bad? Or are you just that lazy? In the docs there's clearly stated you can use LeatherArmorMeta that has a "getColor()" and "setColor()" method.
     
  5. Offline

    caseif

  6. Offline

    Ibix13

    can you stop being jerks and just fricking help me with what i need.
     
  7. Offline

    Zach_1919

    Ibix13 Not to mention the forum post right below the Bukkit JavaDocs, which also has the answer....
     
  8. Offline

    caseif

    We don't intend to be jerks. We're just trying to convey that the solution is spelled out in every one of the sources we've provided.
     
  9. Offline

    Ibix13

    I havn't even learned bukkit so I just want you people to HELP me not be OFFENSIVE

    Can you please just help me with what I need?

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 1, 2016
  10. We helped you three times with what you need and you still don't understand and say we are jerks? Well I have a message for you kiddo, thats life...And if you still don't know what todo then I suggest you to learn more java and/or read the bukkit docs, really I always tought docs were useless but no they aren't!
     
  11. Offline

    caseif

  12. Do this:
    ItemStack armor = new ItemStack(Material.LEATHER_HELMET);
    LeatherArmorMeta meta = armor.getItemMeta();
    meta.setColor(urcolor);
    armor.setItemMeta(meta);
     
  13. Offline

    Zach_1919

    Ibix13 We're not being jerks. We gave you like three different sources that give you EXACTLY what you need to know. I didn't know how to set armor color before I check out his post, but I figured it out because the other two sent you links with the answer right there. If you want to MAKE a plugin, consider learning a bit about Java and Bukkit, otherwise head off to the plugin requests section.
     
  14. Offline

    caseif

    You should avoid giving code for simple issues. If you provide the OP with code, he'll not learn how it works, nor that he should do research prior to posting here.
     
  15. Offline

    Zach_1919

    AngryNerd Seriously. I ALWAYS Google for at least 15 minutes to find something about my issue before I come posting here. I only post about very specific stuff, otherwise Bukkit JavaDocs covers it all.
     
  16. Offline

    Ibix13

    It gives me errors on armor.getItemMeta(); and says Type mismatch: cannot convert from ItemMeta to LeatherArmorMeta. And it says on setColor it is The method setColor(Color) in the type LeatherArmorMeta is not applicable for the arguments (int) here is code:
    Code:
    ItemStack armor = new ItemStack(Material.LEATHER_HELMET);
                                                LeatherArmorMeta meta = armor.getItemMeta();
                                                meta.setColor(0x006600);
                                                armor.setItemMeta(meta);
     
  17. I'm just feeling bad for this guy...Like he said he just wants the code, if he don't understands then that is his problem, we tried 3 times so you can't say we didn't do our best.
     
  18. Offline

    Ibix13

    I've googled it for 2 hours...
     
  19. You have to use ChatColor.<urcolor> and its probably armor.getLeatherArmorMeta() then...
     
  20. Offline

    Zach_1919

    Ibix13 It's because the code is saying that LeatherArmorMeta meta is equals to the ItemMeta of armor. You just need to add a cast to it so it knows it's supposed to be ArmorMeta.

    Code:
    LeatherArmorMeta meta = (LeatherArmorMeta) armor.getItemMeta();
     
  21. Offline

    caseif

    Use CaptainBern's code, but cast LeatherArmorMeta to armor.getItemMeta(). Or maybe it's the other way around... I can never remember that...

    EDIT: Ninja'd by Zach_1919.
     
  22. Offline

    Zach_1919

    Ibix13 Well clearly not....if you click on the first link that @AngryNerdgave you (this), it has two websites right at the top that explain this perfectly. One is in the Bukkit JavaDocs, and the other is in the Bukkit Forums.

    AngryNerd Totally..... crazy Ninya man

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 1, 2016
  23. Offline

    Ibix13

    I fixed the armor.getLeatherArmorMeta but now the setColor is still the same. I changed it to ChatColor.DARK_GREEN btw
     
  24. Offline

    Zach_1919

    Ibix13 Well first, you can't use ChatColor for it, considering that there are like over a million color combinations....and why don't you take a look at what I posted:
     
  25. Offline

    Ibix13

    I already did that....
     
  26. Offline

    Zach_1919

    Ibix13 Ok well you can't use ChatColor. You have to use that FFFFFF stuff or whatever.
     
  27. Offline

    caseif

    For the love of God...
    Code:
    armor.setColor(Color.DARK_GREEN);
    armor.setColor(new Color(#005500));
     
  28. Offline

    Ibix13

    The 0x stuff?
     
  29. ItemMeta is soo confusing...I always use the 'ยง' codes, and for the armor color you need to use Color.<urcolor>
     
  30. Offline

    Zach_1919

    Ibix13 Just look at this:
     
Thread Status:
Not open for further replies.

Share This Page