mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-27 21:29:14 +01:00
Fix CITIZENS-335
This commit is contained in:
parent
6cc965f108
commit
fc0bbc7866
@ -36,6 +36,7 @@ public class EndermanEquipper implements Equipper {
|
||||
if (set.getType() != Material.AIR) {
|
||||
set.setAmount(1);
|
||||
hand.setAmount(hand.getAmount() - 1);
|
||||
equipper.setItemInHand(hand);
|
||||
}
|
||||
npc.getTrait(Equipment.class).set(0, set);
|
||||
}
|
||||
|
@ -14,7 +14,6 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
@ -52,9 +51,7 @@ public class EquipmentEditor extends Editor {
|
||||
Equipper equipper = EQUIPPERS.get(npc.getBukkitEntity().getType());
|
||||
if (equipper == null)
|
||||
equipper = new GenericEquipper();
|
||||
ItemStack hand = event.getPlayer().getItemInHand();
|
||||
equipper.equip(event.getPlayer(), npc);
|
||||
event.getPlayer().setItemInHand(hand.getAmount() > 0 ? hand : null);
|
||||
}
|
||||
|
||||
private static final Map<EntityType, Equipper> EQUIPPERS = Maps.newEnumMap(EntityType.class);
|
||||
|
@ -78,6 +78,7 @@ public class GenericEquipper implements Equipper {
|
||||
clone.setAmount(1);
|
||||
trait.set(slot, clone);
|
||||
hand.setAmount(hand.getAmount() - 1);
|
||||
equipper.setItemInHand(hand);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,5 +26,6 @@ public class PigEquipper implements Equipper {
|
||||
toEquip.getTrait(Saddle.class).toggle();
|
||||
Messaging.sendTr(equipper, Messages.SADDLED_STOPPED, toEquip.getName());
|
||||
}
|
||||
equipper.setItemInHand(hand);
|
||||
}
|
||||
}
|
||||
|
@ -34,5 +34,6 @@ public class SheepEquipper implements Equipper {
|
||||
toEquip.getTrait(WoolColor.class).setColor(DyeColor.WHITE);
|
||||
Messaging.sendTr(equipper, Messages.EQUIPMENT_EDITOR_SHEEP_COLOURED, toEquip.getName(), "white");
|
||||
}
|
||||
equipper.setItemInHand(hand);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user