mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-25 12:15:53 +01:00
Tweak unequipping wolf armor
This commit is contained in:
parent
f78c87b576
commit
f43f919df9
@ -1,5 +1,6 @@
|
||||
package net.citizensnpcs.editor;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
@ -11,6 +12,12 @@ public class WolfEquipper implements Equipper {
|
||||
@Override
|
||||
public void equip(Player equipper, NPC toEquip) {
|
||||
ItemStack hand = equipper.getInventory().getItemInHand();
|
||||
ItemStack equipped = toEquip.getOrAddTrait(Equipment.class).get(EquipmentSlot.BODY);
|
||||
if ((hand == null || hand.getType() == Material.AIR) && equipped != null) {
|
||||
toEquip.getOrAddTrait(Equipment.class).set(EquipmentSlot.BODY, null);
|
||||
equipper.getWorld().dropItem(equipper.getLocation(), equipped);
|
||||
return;
|
||||
}
|
||||
if (hand.getType().name().equals("WOLF_ARMOR")) {
|
||||
ItemStack armor = hand.clone();
|
||||
hand.setAmount(hand.getAmount() - 1);
|
||||
|
Loading…
Reference in New Issue
Block a user