mirror of
https://github.com/taoneill/war.git
synced 2024-11-23 02:35:24 +01:00
Add full leather armor for each team instead of just hat
This commit is contained in:
parent
2b5190434d
commit
18d7bcd9ca
@ -192,8 +192,8 @@ public enum TeamKind {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a colored hat item for the team.
|
||||
* @return Hat item with the team's color.
|
||||
* Get a colored armor item for the team.
|
||||
* @return Armor item with the team's color.
|
||||
*/
|
||||
public ItemStack getHat() {
|
||||
ItemStack helmet = new ItemStack(Material.LEATHER_HELMET);
|
||||
@ -202,4 +202,28 @@ public enum TeamKind {
|
||||
helmet.setItemMeta(meta);
|
||||
return helmet;
|
||||
}
|
||||
|
||||
public ItemStack getChestplate() {
|
||||
ItemStack armor = new ItemStack(Material.LEATHER_CHESTPLATE);
|
||||
LeatherArmorMeta meta = (LeatherArmorMeta) armor.getItemMeta();
|
||||
meta.setColor(this.getBukkitColor());
|
||||
armor.setItemMeta(meta);
|
||||
return armor;
|
||||
}
|
||||
|
||||
public ItemStack getLeggings() {
|
||||
ItemStack leggings = new ItemStack(Material.LEATHER_LEGGINGS);
|
||||
LeatherArmorMeta meta = (LeatherArmorMeta) leggings.getItemMeta();
|
||||
meta.setColor(this.getBukkitColor());
|
||||
leggings.setItemMeta(meta);
|
||||
return leggings;
|
||||
}
|
||||
|
||||
public ItemStack getBoots() {
|
||||
ItemStack boots = new ItemStack(Material.LEATHER_BOOTS);
|
||||
LeatherArmorMeta meta = (LeatherArmorMeta) boots.getItemMeta();
|
||||
meta.setColor(this.getBukkitColor());
|
||||
boots.setItemMeta(meta);
|
||||
return boots;
|
||||
}
|
||||
}
|
||||
|
@ -35,10 +35,19 @@ public class HelmetProtectionTask implements Runnable {
|
||||
|
||||
if (zone.getWarzoneConfig().getBoolean(WarzoneConfig.BLOCKHEADS)) {
|
||||
teamBlockMaterial = team.getKind().getMaterial();
|
||||
// 1) Replace missing block head
|
||||
// 1) Replace missing block armor
|
||||
if (playerInv.getHelmet() == null || playerInv.getHelmet().getType() != Material.LEATHER_HELMET) {
|
||||
playerInv.setHelmet(team.getKind().getHat());
|
||||
}
|
||||
if (playerInv.getChestplate() == null || playerInv.getChestplate().getType() != Material.LEATHER_CHESTPLATE) {
|
||||
playerInv.setChestplate(team.getKind().getChestplate());
|
||||
}
|
||||
if (playerInv.getLeggings() == null || playerInv.getLeggings().getType() != Material.LEATHER_LEGGINGS) {
|
||||
playerInv.setLeggings(team.getKind().getLeggings());
|
||||
}
|
||||
if (playerInv.getBoots() == null || playerInv.getBoots().getType() != Material.LEATHER_BOOTS) {
|
||||
playerInv.setBoots(team.getKind().getBoots());
|
||||
}
|
||||
|
||||
// 2) Get rid of extra blocks in inventory: only keep one
|
||||
HashMap<Integer, ? extends ItemStack> blocks = playerInv.all(teamBlockMaterial);
|
||||
|
Loading…
Reference in New Issue
Block a user