mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-25 20:25:19 +01:00
Tweak unequipping wolf armor
This commit is contained in:
parent
f78c87b576
commit
f43f919df9
@ -1,5 +1,6 @@
|
|||||||
package net.citizensnpcs.editor;
|
package net.citizensnpcs.editor;
|
||||||
|
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
@ -11,6 +12,12 @@ public class WolfEquipper implements Equipper {
|
|||||||
@Override
|
@Override
|
||||||
public void equip(Player equipper, NPC toEquip) {
|
public void equip(Player equipper, NPC toEquip) {
|
||||||
ItemStack hand = equipper.getInventory().getItemInHand();
|
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")) {
|
if (hand.getType().name().equals("WOLF_ARMOR")) {
|
||||||
ItemStack armor = hand.clone();
|
ItemStack armor = hand.clone();
|
||||||
hand.setAmount(hand.getAmount() - 1);
|
hand.setAmount(hand.getAmount() - 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user