mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2025-03-29 06:55:59 +01:00
Drop old item for 'offhand' editing
This commit is contained in:
parent
b558617c2b
commit
3443c0a719
@ -66,6 +66,10 @@ public class EquipmentEditor extends Editor {
|
||||
if (hand.getType() == Material.AIR || hand.getAmount() <= 0) {
|
||||
return;
|
||||
}
|
||||
ItemStack old = npc.getTrait(Equipment.class).get(finalSlot);
|
||||
if (old != null && old.getType() != Material.AIR) {
|
||||
event.getPlayer().getWorld().dropItemNaturally(event.getPlayer().getLocation(), old);
|
||||
}
|
||||
npc.getTrait(Equipment.class).set(finalSlot,
|
||||
new ItemStack(event.getPlayer().getInventory().getItemInMainHand().getType(), 1));
|
||||
hand.setAmount(hand.getAmount() - 1);
|
||||
|
Loading…
Reference in New Issue
Block a user