Give a player Blue Leather Armor?

Discussion in 'Plugin Development' started by MGNick, Jun 18, 2013.

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

    MGNick

    I'm quite new to Bukkit's API, but I'm not new when it comes to programming Java. I want to setup a command lets say /test in which it will give the player Blue Leather Armor set.

    Any help or snippets would be great!

    Thanks!
     
  2. Offline

    caseif

    Create an instance of an ItemStack for each armor piece, get the ItemMeta, cast it to LeatherArmorMeta, set the color, cast it back to ItemMeta, and set it as the stack's ItemMeta.
     
  3. Offline

    chasechocolate

    AngryNerd no need to cast back to ItemMeta as LeatherArmorMeta extends ItemMeta.
     
  4. Offline

    caseif

    Ah, forgot about that. It's been a while since I messed with ItemMeta. :p
     
  5. Offline

    nitrousspark

    Code:
    public static ItemStack createColorArmor(ItemStack i, Color c)
    {
    LeatherArmorMeta meta = (LeatherArmorMeta)i.getItemMeta();
    meta.setColor(c);
    i.setItemMeta(meta);
    return i;
    }
     
Thread Status:
Not open for further replies.

Share This Page