Help? Bukkit plugin code thing for dyed leather armor?

Discussion in 'Plugin Development' started by burbur2, Feb 8, 2014.

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

    burbur2

    Hey I'm making a plugin where you can do /redarmour or /cyanarmour etc and I need help this is what I have the in then line that I'm stuck on:

    inventory.addItem(new ItemStack(Material.*NEED HELP HERE*))

    What do I put for dyed armor? (Please tell me for all the colours).

    Thanks, and sorry if I don't make any sense in my post, this is my first plugin.

    -burbur2
     
  2. Offline

    SquidFruit

    Code:
    Material type = stack.getType();
    short dat = stack.getDurability();
     
    public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args){
                Player player = (Player) sender;
                if (commandLabel.equalsIgnoreCase("redarmour")){
    if (type == Material.LEATHER_CHESTPLATE) {
    if (player.getItemInHand().getAmount() == 1) {
                    player.getInventory().removeItem(player.getInventory().getItemInHand());
     
    //then give the player the item by using the data value or type == Material.INK_SACK) {
    //if (dat == 4)
    //{
    //}
    //}
     
  3. Offline

    Gater12

  4. Offline

    burbur2

    Hmm I'm taking a look at it now, I'm new to all this java thing, so I appreciate you guys helping me :).

    But isn't there an id or something for each type of leather armor? I may be wrong.

    Also can someone please show me the easiest way to do it? Thanks!

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

    HungerCraftNL

    PHP:
    ItemStack item = new ItemStack(Material.MATERIAL1);
    LeatherArmorMeta im = (LeatherArmorMetaitem.getItemMeta();
    im.setColor(Color.COLOR);
    item.setItemMeta(im);
     
  6. Offline

    burbur2

    HungerCraftNL Is that it? Or do I need to set a color? And how do I set a color for the armor?

    Thanks so much btw!
     
  7. Offline

    AoH_Ruthless

    burbur2
    That code sets the color for the armor...
    Now, I'm going to take the same method HungerCraftNL so graciously gave you and explain it.
    Code:java
    1. ItemStack item = new ItemStack(Material.MATERIAL, 1);

    We are going to take an itemstack that is a given material enum and with 1 amount and cast it to the variable item. Now, throughout the rest of the method. Remember, you have to replace MATERIAL with your Material Enum (Some sort of Leather gear or else the rest of the code will not work.

    Now:
    Code:java
    1. LeatherArmorMeta im = (LeatherArmorMeta) item.getItemMeta();

    Bukkit Uses something called 'ItemMeta' for determining important aspects of materials, such as enchantments or lore. In this case, the "LeatherArmorMeta" is specific to Leather armor. We cast it to im to use throughout the rest of the method. We cannot just cast randomly without any goal, so the cast (which is a form of itemmeta) is associated with the items meta, which can be obtained using .getItemMeta();

    Next:
    Code:java
    1. im.setColor(Color.COLOR);

    We set the item meta's color (an attribute of leather item meta) to a color. This is an enum value, so replace COLOR with a Bukkit color. Doing this will set the item meta color to the color you specify.

    And Finally:
    Code:java
    1. item.setItemMeta(im);

    We have set our item meta to the color we want, but we do nothing with it! To actually incorporate it into the item, we have to get the itemstack (previously casted as 'item'), and set it's item meta to the item meta we have been working with (im).


    Hopefully that explained it all to you! If you don't understand lots of what I was saying, now is a good time to go learn some Java and view the Bukkit Documentation.
     
  8. Offline

    Maurdekye

    burbur2 The line Color.COLOR he referenced up there is an enum. You should already know what an enum is, as the Material class is one too. To access different colors, you put Color.RED, or Color.BLUE, or Color.GREEN, and so on.
     
  9. Offline

    Chibbey

    Ok to set Color for armor it would be like this... Here ill give you all the code pretty much for cyan armour and red armour.
    Code:java
    1. package me.chibbey.armourcoloring;
    2.  
    3. import org.bukkit.ChatColor;
    4. import org.bukkit.Color;
    5. import org.bukkit.Material;
    6. import org.bukkit.command.Command;
    7. import org.bukkit.command.CommandSender;
    8. import org.bukkit.entity.Player;
    9. import org.bukkit.event.Listener;
    10. import org.bukkit.inventory.ItemStack;
    11. import org.bukkit.inventory.meta.LeatherArmorMeta;
    12. import org.bukkit.plugin.java.JavaPlugin;
    13.  
    14. public class ArmourColoring extends JavaPlugin implements Listener {
    15.  
    16. public void onEnable() {
    17.  
    18. }
    19.  
    20. public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
    21.  
    22. if (!(sender instanceof Player)) {
    23. sender.sendMessage(ChatColor.RED + "You are not allowed to get Armour!");
    24. return true;
    25. }
    26. Player p = (Player) sender;
    27.  
    28. if (commandLabel.equalsIgnoreCase("redarmour")) {
    29.  
    30. // ItemStacks
    31. ItemStack redhelmet = new ItemStack(Material.LEATHER_HELMET);
    32. ItemStack redchestplate = new ItemStack(Material.LEATHER_CHESTPLATE);
    33. ItemStack redleggings = new ItemStack(Material.LEATHER_LEGGINGS);
    34. ItemStack redboots = new ItemStack(Material.LEATHER_BOOTS);
    35.  
    36. // ItemMeta
    37. LeatherArmorMeta redhelmetmeta = (LeatherArmorMeta) redhelmet.getItemMeta();
    38. LeatherArmorMeta redchestplatemeta = (LeatherArmorMeta) redchestplate.getItemMeta();
    39. LeatherArmorMeta redleggingsmeta = (LeatherArmorMeta) redleggings.getItemMeta();
    40. LeatherArmorMeta redbootsmeta = (LeatherArmorMeta) redboots.getItemMeta();
    41.  
    42. // Changing Color
    43. redhelmetmeta.setColor(Color.RED);
    44. redchestplatemeta.setColor(Color.RED);
    45. redleggingsmeta.setColor(Color.RED);
    46. redbootsmeta.setColor(Color.RED);
    47.  
    48. // Changing Names
    49. redhelmetmeta.setDisplayName(ChatColor.RED + "Red Helmet");
    50. redchestplatemeta.setDisplayName(ChatColor.RED + "Red Chestplate");
    51. redleggingsmeta.setDisplayName(ChatColor.RED + "Red Leggings");
    52. redbootsmeta.setDisplayName(ChatColor.RED + "Red Boots");
    53.  
    54. // Setting ItemMeta
    55. redhelmet.setItemMeta(redhelmetmeta);
    56. redchestplate.setItemMeta(redchestplatemeta);
    57. redleggings.setItemMeta(redleggingsmeta);
    58. redboots.setItemMeta(redbootsmeta);
    59.  
    60. // Giving them the Armour - setHelmet, SetChestplate, etc makes it so the armors equipped and not just given to them
    61. p.getInventory().setHelmet(redhelmet);
    62. p.getInventory().setChestplate(redchestplate);
    63. p.getInventory().setLeggings(redleggings);
    64. p.getInventory().setBoots(redboots);
    65. }
    66.  
    67. if (commandLabel.equalsIgnoreCase("cyanarmour")) {
    68.  
    69. // ItemStacks
    70. ItemStack cyanhelmet = new ItemStack(Material.LEATHER_HELMET);
    71. ItemStack cyanchestplate = new ItemStack(Material.LEATHER_CHESTPLATE);
    72. ItemStack cyanleggings = new ItemStack(Material.LEATHER_LEGGINGS);
    73. ItemStack cyanboots = new ItemStack(Material.LEATHER_BOOTS);
    74.  
    75. // ItemMeta
    76. LeatherArmorMeta cyanhelmetmeta = (LeatherArmorMeta) cyanhelmet.getItemMeta();
    77. LeatherArmorMeta cyanchestplatemeta = (LeatherArmorMeta) cyanchestplate.getItemMeta();
    78. LeatherArmorMeta cyanleggingsmeta = (LeatherArmorMeta) cyanleggings.getItemMeta();
    79. LeatherArmorMeta cyanbootsmeta = (LeatherArmorMeta) cyanboots.getItemMeta();
    80.  
    81. // Changing Color
    82. cyanhelmetmeta.setColor(Color.FUCHSIA);// I think FUCHSIA is Cyan cause there's no actual Color.CYAN
    83. cyanchestplatemeta.setColor(Color.FUCHSIA);
    84. cyanleggingsmeta.setColor(Color.FUCHSIA);
    85. cyanbootsmeta.setColor(Color.FUCHSIA);
    86.  
    87. // Changing Names
    88. cyanhelmetmeta.setDisplayName(ChatColor.RED + "Cyan Helmet");
    89. cyanchestplatemeta.setDisplayName(ChatColor.RED + "Cyan Chestplate");
    90. cyanleggingsmeta.setDisplayName(ChatColor.RED + "Cyan Leggings");
    91. cyanbootsmeta.setDisplayName(ChatColor.RED + "Cyan Boots");
    92.  
    93. // Setting ItemMeta
    94. cyanhelmet.setItemMeta(cyanhelmetmeta);
    95. cyanchestplate.setItemMeta(cyanchestplatemeta);
    96. cyanleggings.setItemMeta(cyanleggingsmeta);
    97. cyanboots.setItemMeta(cyanbootsmeta);
    98.  
    99. // Giving them the Armour - setHelmet, SetChestplate, etc makes it so the armors equipped and not just given to them
    100. p.getInventory().setHelmet(cyanhelmet);
    101. p.getInventory().setChestplate(cyanchestplate);
    102. p.getInventory().setLeggings(cyanleggings);
    103. p.getInventory().setBoots(cyanboots);
    104. }
    105. return true;
    106. }
    107.  
    108. }
     
  10. Offline

    AoH_Ruthless

    Chibbey
    You just confused him (and me kinda) probably ... Also, your code is pretty inefficient (just the sheer repetitiveness and length of it)!
     
  11. Offline

    Maurdekye

    Chibbey Here, you could make that a bit shorter by doing this;
    Code:java
    1. ArrayList<ItemStack> contents = new ArrayList<ItemStack>();
    2. for (String suffix : Arrays.asList("Helmet", "Chestplate", "Leggings", "Boots")) {
    3. ItemStack armorPiece = new ItemStack(Material.valueOf("LEATHER_" + suffix.toUpperCase()));
    4. LeatherArmorMeta meta = (LeatherArmorMeta) armorPiece.getItemMeta();
    5. meta.setColor(Color.RED);
    6. contents.add(armorPiece);
    7. }
    8. p.getInventory().setContents(contents.toArray(new ItemStack[4]));


    And if you want multiple colors, just replace the Color.RED with whatever color you like.
     
  12. Offline

    burbur2

    Thank you all! Sorry I have been un-responsive I fell asleep lol.

    I can't thank you enough, it's nice to see people helping others who are new to coding!

    So I've been looking at some bukkit websites and I've tried to use what it said. Is this correct? Will this work?:
    Code:java
    1. package me.burbur.DyedArmour;
    2.  
    3.  
    4. import org.bukkit.Color;
    5. import org.bukkit.Material;
    6. import org.bukkit.command.Command;
    7. import org.bukkit.command.CommandSender;
    8. import org.bukkit.entity.Player;
    9. import org.bukkit.event.Listener;
    10. import org.bukkit.inventory.ItemStack;
    11. import org.bukkit.inventory.meta.LeatherArmorMeta;
    12. import org.bukkit.plugin.java.JavaPlugin;
    13.  
    14. public class DyedArmour extends JavaPlugin implements Listener {
    15.  
    16. @Override
    17. public void onEnable() {
    18.  
    19. }
    20. @Override
    21. public void onDisable(){
    22.  
    23. }
    24. public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
    25. Player player = (Player) sender;
    26. if(commandLabel.equalsIgnoreCase("redarmor")) {
    27. ItemStack lhelm = new ItemStack(Material.LEATHER_HELMET);
    28. LeatherArmorMeta lhma = (LeatherArmorMeta)lhelm.getItemMeta();
    29. lhma.setColor(Color.RED);
    30. lhelm.setItemMeta(lhma);
    31. player.getInventory().setHelmet(lhelm);
    32.  
    33. ItemStack lchest = new ItemStack(Material.LEATHER_CHESTPLATE);
    34. LeatherArmorMeta lches = (LeatherArmorMeta)lchest.getItemMeta();
    35. lches.setColor(Color.RED);
    36. lchest.setItemMeta(lhma);
    37. player.getInventory().setHelmet(lchest);
    38.  
    39. ItemStack llegg = new ItemStack(Material.LEATHER_LEGGINGS);
    40. LeatherArmorMeta lleg = (LeatherArmorMeta)lhelm.getItemMeta();
    41. lleg.setColor(Color.RED);
    42. lhelm.setItemMeta(lleg);
    43. player.getInventory().setHelmet(llegg);
    44.  
    45. ItemStack lboot = new ItemStack(Material.LEATHER_BOOTS);
    46. LeatherArmorMeta lboo = (LeatherArmorMeta)lhelm.getItemMeta();
    47. lboo.setColor(Color.RED);
    48. lboot.setItemMeta(lboo);
    49. player.getInventory().setHelmet(lhelm);
    50.  
    51. }
    52.  
    53. if (commandLabel.equalsIgnoreCase("bluearmor")) {
    54.  
    55. ItemStack lhelm = new ItemStack(Material.LEATHER_HELMET);
    56. LeatherArmorMeta lhma = (LeatherArmorMeta)lhelm.getItemMeta();
    57. lhma.setColor(Color.BLUE);
    58. lhelm.setItemMeta(lhma);
    59. player.getInventory().setHelmet(lhelm);
    60.  
    61. ItemStack lchest = new ItemStack(Material.LEATHER_CHESTPLATE);
    62. LeatherArmorMeta lches = (LeatherArmorMeta)lchest.getItemMeta();
    63. lches.setColor(Color.BLUE);
    64. lchest.setItemMeta(lhma);
    65. player.getInventory().setHelmet(lchest);
    66.  
    67. ItemStack llegg = new ItemStack(Material.LEATHER_LEGGINGS);
    68. LeatherArmorMeta lleg = (LeatherArmorMeta)lhelm.getItemMeta();
    69. lleg.setColor(Color.BLUE);
    70. lhelm.setItemMeta(lleg);
    71. player.getInventory().setHelmet(llegg);
    72.  
    73. ItemStack lboot = new ItemStack(Material.LEATHER_BOOTS);
    74. LeatherArmorMeta lboo = (LeatherArmorMeta)lhelm.getItemMeta();
    75. lboo.setColor(Color.BLUE);
    76. lboot.setItemMeta(lboo);
    77. player.getInventory().setHelmet(lhelm);
    78.  
    79. }
    80.  
    81. if (commandLabel.equalsIgnoreCase("yellowarmor")) {
    82.  
    83. ItemStack lhelm = new ItemStack(Material.LEATHER_HELMET);
    84. LeatherArmorMeta lhma = (LeatherArmorMeta)lhelm.getItemMeta();
    85. lhma.setColor(Color.YELLOW);
    86. lhelm.setItemMeta(lhma);
    87. player.getInventory().setHelmet(lhelm);
    88.  
    89. ItemStack lchest = new ItemStack(Material.LEATHER_CHESTPLATE);
    90. LeatherArmorMeta lches = (LeatherArmorMeta)lchest.getItemMeta();
    91. lches.setColor(Color.YELLOW);
    92. lchest.setItemMeta(lhma);
    93. player.getInventory().setHelmet(lchest);
    94.  
    95. ItemStack llegg = new ItemStack(Material.LEATHER_LEGGINGS);
    96. LeatherArmorMeta lleg = (LeatherArmorMeta)lhelm.getItemMeta();
    97. lleg.setColor(Color.YELLOW);
    98. lhelm.setItemMeta(lleg);
    99. player.getInventory().setHelmet(llegg);
    100.  
    101. ItemStack lboot = new ItemStack(Material.LEATHER_BOOTS);
    102. LeatherArmorMeta lboo = (LeatherArmorMeta)lhelm.getItemMeta();
    103. lboo.setColor(Color.YELLOW);
    104. lboot.setItemMeta(lboo);
    105. player.getInventory().setHelmet(lhelm);
    106. }
    107.  
    108. if (commandLabel.equalsIgnoreCase("orangearmor")) {
    109.  
    110. ItemStack lhelm = new ItemStack(Material.LEATHER_HELMET);
    111. LeatherArmorMeta lhma = (LeatherArmorMeta)lhelm.getItemMeta();
    112. lhma.setColor(Color.ORANGE);
    113. lhelm.setItemMeta(lhma);
    114. player.getInventory().setHelmet(lhelm);
    115.  
    116. ItemStack lchest = new ItemStack(Material.LEATHER_CHESTPLATE);
    117. LeatherArmorMeta lches = (LeatherArmorMeta)lchest.getItemMeta();
    118. lches.setColor(Color.ORANGE);
    119. lchest.setItemMeta(lhma);
    120. player.getInventory().setHelmet(lchest);
    121.  
    122. ItemStack llegg = new ItemStack(Material.LEATHER_LEGGINGS);
    123. LeatherArmorMeta lleg = (LeatherArmorMeta)lhelm.getItemMeta();
    124. lleg.setColor(Color.ORANGE);
    125. lhelm.setItemMeta(lleg);
    126. player.getInventory().setHelmet(llegg);
    127.  
    128. ItemStack lboot = new ItemStack(Material.LEATHER_BOOTS);
    129. LeatherArmorMeta lboo = (LeatherArmorMeta)lhelm.getItemMeta();
    130. lboo.setColor(Color.ORANGE);
    131. lboot.setItemMeta(lboo);
    132. player.getInventory().setHelmet(lhelm);
    133.  
    134. }
    135.  
    136. if (commandLabel.equalsIgnoreCase("limearmor")) {
    137.  
    138. ItemStack lhelm = new ItemStack(Material.LEATHER_HELMET);
    139. LeatherArmorMeta lhma = (LeatherArmorMeta)lhelm.getItemMeta();
    140. lhma.setColor(Color.LIME);
    141. lhelm.setItemMeta(lhma);
    142. player.getInventory().setHelmet(lhelm);
    143.  
    144. ItemStack lchest = new ItemStack(Material.LEATHER_CHESTPLATE);
    145. LeatherArmorMeta lches = (LeatherArmorMeta)lchest.getItemMeta();
    146. lches.setColor(Color.LIME);
    147. lchest.setItemMeta(lhma);
    148. player.getInventory().setHelmet(lchest);
    149.  
    150. ItemStack llegg = new ItemStack(Material.LEATHER_LEGGINGS);
    151. LeatherArmorMeta lleg = (LeatherArmorMeta)lhelm.getItemMeta();
    152. lleg.setColor(Color.LIME);
    153. lhelm.setItemMeta(lleg);
    154. player.getInventory().setHelmet(llegg);
    155.  
    156. ItemStack lboot = new ItemStack(Material.LEATHER_BOOTS);
    157. LeatherArmorMeta lboo = (LeatherArmorMeta)lhelm.getItemMeta();
    158. lboo.setColor(Color.LIME);
    159. lboot.setItemMeta(lboo);
    160. player.getInventory().setHelmet(lhelm);
    161.  
    162. }
    163.  
    164. if (commandLabel.equalsIgnoreCase("cyanarmor")) {
    165.  
    166. ItemStack lhelm = new ItemStack(Material.LEATHER_HELMET);
    167. LeatherArmorMeta lhma = (LeatherArmorMeta)lhelm.getItemMeta();
    168. lhma.setColor(Color.FUCHSIA);
    169. lhelm.setItemMeta(lhma);
    170. player.getInventory().setHelmet(lhelm);
    171.  
    172. ItemStack lchest = new ItemStack(Material.LEATHER_CHESTPLATE);
    173. LeatherArmorMeta lches = (LeatherArmorMeta)lchest.getItemMeta();
    174. lches.setColor(Color.FUCHSIA);
    175. lchest.setItemMeta(lhma);
    176. player.getInventory().setHelmet(lchest);
    177.  
    178. ItemStack llegg = new ItemStack(Material.LEATHER_LEGGINGS);
    179. LeatherArmorMeta lleg = (LeatherArmorMeta)lhelm.getItemMeta();
    180. lleg.setColor(Color.FUCHSIA);
    181. lhelm.setItemMeta(lleg);
    182. player.getInventory().setHelmet(llegg);
    183.  
    184. ItemStack lboot = new ItemStack(Material.LEATHER_BOOTS);
    185. LeatherArmorMeta lboo = (LeatherArmorMeta)lhelm.getItemMeta();
    186. lboo.setColor(Color.BLUE);
    187. lboot.setItemMeta(lboo);
    188. player.getInventory().setHelmet(lhelm);
    189.  
    190. }
    191.  
    192. if (commandLabel.equalsIgnoreCase("greenarmor")) {
    193.  
    194. ItemStack lhelm = new ItemStack(Material.LEATHER_HELMET);
    195. LeatherArmorMeta lhma = (LeatherArmorMeta)lhelm.getItemMeta();
    196. lhma.setColor(Color.GREEN);
    197. lhelm.setItemMeta(lhma);
    198. player.getInventory().setHelmet(lhelm);
    199.  
    200. ItemStack lchest = new ItemStack(Material.LEATHER_CHESTPLATE);
    201. LeatherArmorMeta lches = (LeatherArmorMeta)lchest.getItemMeta();
    202. lches.setColor(Color.GREEN);
    203. lchest.setItemMeta(lhma);
    204. player.getInventory().setHelmet(lchest);
    205.  
    206. ItemStack llegg = new ItemStack(Material.LEATHER_LEGGINGS);
    207. LeatherArmorMeta lleg = (LeatherArmorMeta)lhelm.getItemMeta();
    208. lleg.setColor(Color.GREEN);
    209. lhelm.setItemMeta(lleg);
    210. player.getInventory().setHelmet(llegg);
    211.  
    212. ItemStack lboot = new ItemStack(Material.LEATHER_BOOTS);
    213. LeatherArmorMeta lboo = (LeatherArmorMeta)lhelm.getItemMeta();
    214. lboo.setColor(Color.GREEN);
    215. lboot.setItemMeta(lboo);
    216. player.getInventory().setHelmet(lhelm);
    217.  
    218. }
    219.  
    220. if (commandLabel.equalsIgnoreCase("blackarmor")) {
    221.  
    222. ItemStack lhelm = new ItemStack(Material.LEATHER_HELMET);
    223. LeatherArmorMeta lhma = (LeatherArmorMeta)lhelm.getItemMeta();
    224. lhma.setColor(Color.BLACK);
    225. lhelm.setItemMeta(lhma);
    226. player.getInventory().setHelmet(lhelm);
    227.  
    228. ItemStack lchest = new ItemStack(Material.LEATHER_CHESTPLATE);
    229. LeatherArmorMeta lches = (LeatherArmorMeta)lchest.getItemMeta();
    230. lches.setColor(Color.BLACK);
    231. lchest.setItemMeta(lhma);
    232. player.getInventory().setHelmet(lchest);
    233.  
    234. ItemStack llegg = new ItemStack(Material.LEATHER_LEGGINGS);
    235. LeatherArmorMeta lleg = (LeatherArmorMeta)lhelm.getItemMeta();
    236. lleg.setColor(Color.BLACK);
    237. lhelm.setItemMeta(lleg);
    238. player.getInventory().setHelmet(llegg);
    239.  
    240. ItemStack lboot = new ItemStack(Material.LEATHER_BOOTS);
    241. LeatherArmorMeta lboo = (LeatherArmorMeta)lhelm.getItemMeta();
    242. lboo.setColor(Color.BLACK);
    243. lboot.setItemMeta(lboo);
    244. player.getInventory().setHelmet(lhelm);
    245.  
    246. }
    247.  
    248. if (commandLabel.equalsIgnoreCase("purplearmor")) {
    249.  
    250. ItemStack lhelm = new ItemStack(Material.LEATHER_HELMET);
    251. LeatherArmorMeta lhma = (LeatherArmorMeta)lhelm.getItemMeta();
    252. lhma.setColor(Color.PURPLE);
    253. lhelm.setItemMeta(lhma);
    254. player.getInventory().setHelmet(lhelm);
    255.  
    256. ItemStack lchest = new ItemStack(Material.LEATHER_CHESTPLATE);
    257. LeatherArmorMeta lches = (LeatherArmorMeta)lchest.getItemMeta();
    258. lches.setColor(Color.PURPLE);
    259. lchest.setItemMeta(lhma);
    260. player.getInventory().setHelmet(lchest);
    261.  
    262. ItemStack llegg = new ItemStack(Material.LEATHER_LEGGINGS);
    263. LeatherArmorMeta lleg = (LeatherArmorMeta)lhelm.getItemMeta();
    264. lleg.setColor(Color.PURPLE);
    265. lhelm.setItemMeta(lleg);
    266. player.getInventory().setHelmet(llegg);
    267.  
    268. ItemStack lboot = new ItemStack(Material.LEATHER_BOOTS);
    269. LeatherArmorMeta lboo = (LeatherArmorMeta)lhelm.getItemMeta();
    270. lboo.setColor(Color.PURPLE);
    271. lboot.setItemMeta(lboo);
    272. player.getInventory().setHelmet(lhelm);
    273.  
    274. }
    275.  
    276. if (commandLabel.equalsIgnoreCase("whitearmor")) {
    277.  
    278. ItemStack lhelm = new ItemStack(Material.LEATHER_HELMET);
    279. LeatherArmorMeta lhma = (LeatherArmorMeta)lhelm.getItemMeta();
    280. lhma.setColor(Color.WHITE);
    281. lhelm.setItemMeta(lhma);
    282. player.getInventory().setHelmet(lhelm);
    283.  
    284. ItemStack lchest = new ItemStack(Material.LEATHER_CHESTPLATE);
    285. LeatherArmorMeta lches = (LeatherArmorMeta)lchest.getItemMeta();
    286. lches.setColor(Color.WHITE);
    287. lchest.setItemMeta(lhma);
    288. player.getInventory().setHelmet(lchest);
    289.  
    290. ItemStack llegg = new ItemStack(Material.LEATHER_LEGGINGS);
    291. LeatherArmorMeta lleg = (LeatherArmorMeta)lhelm.getItemMeta();
    292. lleg.setColor(Color.WHITE);
    293. lhelm.setItemMeta(lleg);
    294. player.getInventory().setHelmet(llegg);
    295.  
    296. ItemStack lboot = new ItemStack(Material.LEATHER_BOOTS);
    297. LeatherArmorMeta lboo = (LeatherArmorMeta)lhelm.getItemMeta();
    298. lboo.setColor(Color.WHITE);
    299. lboot.setItemMeta(lboo);
    300. player.getInventory().setHelmet(lhelm);
    301.  
    302. }
    303.  
    304. if (commandLabel.equalsIgnoreCase("Grayor")) {
    305.  
    306. ItemStack lhelm = new ItemStack(Material.LEATHER_HELMET);
    307. LeatherArmorMeta lhma = (LeatherArmorMeta)lhelm.getItemMeta();
    308. lhma.setColor(Color.GRAY);
    309. lhelm.setItemMeta(lhma);
    310. player.getInventory().setHelmet(lhelm);
    311.  
    312. ItemStack lchest = new ItemStack(Material.LEATHER_CHESTPLATE);
    313. LeatherArmorMeta lches = (LeatherArmorMeta)lchest.getItemMeta();
    314. lches.setColor(Color.GRAY);
    315. lchest.setItemMeta(lhma);
    316. player.getInventory().setHelmet(lchest);
    317.  
    318. ItemStack llegg = new ItemStack(Material.LEATHER_LEGGINGS);
    319. LeatherArmorMeta lleg = (LeatherArmorMeta)lhelm.getItemMeta();
    320. lleg.setColor(Color.GRAY);
    321. lhelm.setItemMeta(lleg);
    322. player.getInventory().setHelmet(llegg);
    323.  
    324. ItemStack lboot = new ItemStack(Material.LEATHER_BOOTS);
    325. LeatherArmorMeta lboo = (LeatherArmorMeta)lhelm.getItemMeta();
    326. lboo.setColor(Color.GRAY);
    327. lboot.setItemMeta(lboo);
    328. player.getInventory().setHelmet(lhelm);
    329.  
    330. }
    331. }
    332. }
    333.  
    334.  
    335.  
    336.  
    It's pretty long, but I don't mind writing long codes. Someone please tell me if I'm doing it correctly!

    Thank you to everyone who posted!
     
  13. Offline

    MCJoshua345

Thread Status:
Not open for further replies.

Share This Page