Fix HatGadgets only displaying glass

This commit is contained in:
Sam 2017-11-29 16:08:51 +00:00 committed by Alexander Meech
parent bf1d2e4b71
commit 87f35fecca

View File

@ -85,7 +85,17 @@ public abstract class OutfitGadget extends Gadget
if (message)
UtilPlayer.message(player, F.main(Manager.getName(), "You put on " + F.elem(getName()) + "."));
ItemStack itemStack = new ItemStack(getDisplayMaterial(), 1, getDisplayData());
ItemStack itemStack;
if (getDisplayItem() == null)
{
itemStack = new ItemStack(getDisplayMaterial(), 1, getDisplayData());
}
else
{
itemStack = getDisplayItem();
}
if (getColor() != null)
{
if (itemStack.getItemMeta() instanceof LeatherArmorMeta)
@ -97,13 +107,21 @@ public abstract class OutfitGadget extends Gadget
}
}
if (_slot == ArmorSlot.HELMET) player.getInventory().setHelmet(itemStack);
else if (_slot == ArmorSlot.CHEST) player.getInventory().setChestplate(itemStack);
else if (_slot == ArmorSlot.LEGS) player.getInventory().setLeggings(itemStack);
else if (_slot == ArmorSlot.BOOTS) player.getInventory().setBoots(itemStack);
switch (_slot)
{
case HELMET:
player.getInventory().setHelmet(itemStack);
break;
case CHEST:
player.getInventory().setChestplate(itemStack);
break;
case LEGS:
player.getInventory().setLeggings(itemStack);
break;
case BOOTS:
player.getInventory().setBoots(itemStack);
break;
}
}
public void removeArmor(Player player, boolean message)
@ -113,10 +131,21 @@ public abstract class OutfitGadget extends Gadget
if (message)
UtilPlayer.message(player, F.main("Gadget", "You took off " + F.elem(getName()) + "."));
if (_slot == ArmorSlot.HELMET) player.getInventory().setHelmet(null);
else if (_slot == ArmorSlot.CHEST) player.getInventory().setChestplate(null);
else if (_slot == ArmorSlot.LEGS) player.getInventory().setLeggings(null);
else if (_slot == ArmorSlot.BOOTS) player.getInventory().setBoots(null);
switch (_slot)
{
case HELMET:
player.getInventory().setHelmet(null);
break;
case CHEST:
player.getInventory().setChestplate(null);
break;
case LEGS:
player.getInventory().setLeggings(null);
break;
case BOOTS:
player.getInventory().setBoots(null);
break;
}
}
}