From f43f919df94b01a1876de682c2461e6a492a1278 Mon Sep 17 00:00:00 2001 From: fullwall Date: Mon, 12 Aug 2024 20:31:57 +0800 Subject: [PATCH] Tweak unequipping wolf armor --- .../main/java/net/citizensnpcs/editor/WolfEquipper.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/main/src/main/java/net/citizensnpcs/editor/WolfEquipper.java b/main/src/main/java/net/citizensnpcs/editor/WolfEquipper.java index 390d0eac7..dc53d0ebe 100644 --- a/main/src/main/java/net/citizensnpcs/editor/WolfEquipper.java +++ b/main/src/main/java/net/citizensnpcs/editor/WolfEquipper.java @@ -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);