mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-27 21:29:14 +01:00
Support generic equipping
This commit is contained in:
parent
af81d49565
commit
6ee3c65614
@ -51,7 +51,7 @@ public class EquipmentEditor extends Editor {
|
||||
|
||||
Equipper equipper = EQUIPPERS.get(npc.getBukkitEntity().getType());
|
||||
if (equipper == null)
|
||||
return;
|
||||
equipper = new GenericEquipper();
|
||||
ItemStack hand = event.getPlayer().getItemInHand();
|
||||
equipper.equip(event.getPlayer(), npc);
|
||||
event.getPlayer().setItemInHand(hand.getAmount() > 0 ? hand : null);
|
||||
@ -60,7 +60,6 @@ public class EquipmentEditor extends Editor {
|
||||
private static final Map<EntityType, Equipper> EQUIPPERS = Maps.newEnumMap(EntityType.class);
|
||||
static {
|
||||
EQUIPPERS.put(EntityType.PIG, new PigEquipper());
|
||||
EQUIPPERS.put(EntityType.PLAYER, new HumanEquipper());
|
||||
EQUIPPERS.put(EntityType.SHEEP, new SheepEquipper());
|
||||
EQUIPPERS.put(EntityType.ENDERMAN, new EndermanEquipper());
|
||||
}
|
||||
|
@ -9,8 +9,7 @@ import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class HumanEquipper implements Equipper {
|
||||
|
||||
public class GenericEquipper implements Equipper {
|
||||
@Override
|
||||
public void equip(Player equipper, NPC toEquip) {
|
||||
ItemStack hand = equipper.getItemInHand();
|
Loading…
Reference in New Issue
Block a user