package com.lifeknight.relaymchub.cosmetics; import com.lifeknight.relaymchub.cosmetics.types.BootsApplication; import com.lifeknight.relaymchub.cosmetics.types.ChestplateApplication; import com.lifeknight.relaymchub.cosmetics.types.HelmetApplication; import com.lifeknight.relaymchub.cosmetics.types.LeggingsApplication; import com.lifeknight.relayutils.player.cosmetics.Cosmetic; import org.bukkit.Material; import org.bukkit.inventory.EquipmentSlot; import org.bukkit.inventory.ItemStack; public class ArmorCosmetic extends DefinedLobbyCosmetic { public ArmorCosmetic(Cosmetic original, ItemStack helmet, ItemStack chestplate, ItemStack leggings, ItemStack boots) { super(original); if (helmet != null) { this.addApplication(new HelmetApplication(helmet)); } if (chestplate != null) { this.addApplication(new ChestplateApplication(chestplate)); } if (leggings != null) { this.addApplication(new LeggingsApplication(leggings)); } if (boots != null) { this.addApplication(new BootsApplication(boots)); } } public ArmorCosmetic(Cosmetic original, Material helmet, Material chestplate, Material leggings, Material boots) { this(original, get(helmet), get(chestplate), get(leggings), get(boots)); } public ArmorCosmetic(Cosmetic original, ItemStack itemStack, EquipmentSlot equipmentSlot) { super(original); switch (equipmentSlot) { case HEAD: this.addApplication(new HelmetApplication(itemStack)); break; case CHEST: this.addApplication(new ChestplateApplication(itemStack)); break; case LEGS: this.addApplication(new LeggingsApplication(itemStack)); break; case FEET: this.addApplication(new BootsApplication(itemStack)); break; } } public ArmorCosmetic(Cosmetic original, Material material, EquipmentSlot equipmentSlot) { this(original, get(material), equipmentSlot); } public ArmorCosmetic(Cosmetic original, EquipmentSlot equipmentSlot) { this(original, original.getRepresentative(), equipmentSlot); } private static ItemStack get(Material material) { if (material == null) { return null; } return new ItemStack(material); } @Override public boolean shouldDisable(DefinedLobbyCosmetic other) { return super.shouldDisable(other) || other instanceof MorphCosmetic; } }