How would I clear someones armor? Probably a stupid question but I can't figure it out and p.getInventory().clear(); doesn't do armor.
Okay, Loop through the armour slots (100 - 103, I think), and setItem() to null. Like this: Code: for(int i = 100; i <= 103; i++) { inv.setItem(i, null); }
....... seems tedious... maybe p.getInventory().setHelmet(null); and the chestplate and then leggings an boots? Just is a little confusing and isn't as visual for me. EDIT by Moderator: merged posts, please use the edit button instead of double posting.
You may have already found this but: Code:Java PlayerInventory inv = player.getInventory();inv.setArmorContents(new ItemStack[inv.getArmorContents().length]);
player.getInventory().setHelmet(null); player.getInventory().setChestplate(null); player.getInventory().setLeggings(null); player.getInventory().setBoots(null); Works, too
Code:java public void clearArmor(Player player){player.getInventory().setHelmet(null);player.getInventory().setChestplate(null);player.getInventory().setLeggings(null);player.getInventory().setBoots(null);} Or just make a method that you call back when you need it