mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2025-02-16 12:21:25 +01:00
Add Wolf armor equipper
This commit is contained in:
parent
c8f6e4f4ec
commit
fe2a9990d3
@ -108,6 +108,7 @@ public class EquipmentEditor extends Editor {
|
||||
EQUIPPER_GUIS.put(EntityType.ENDERMAN, EndermanEquipperGUI.class);
|
||||
EQUIPPERS.put(EntityType.SHEEP, new SheepEquipper());
|
||||
EQUIPPERS.put(EntityType.HORSE, new HorseEquipper());
|
||||
EQUIPPERS.put(EntityType.WOLF, new WolfEquipper());
|
||||
for (EntityType type : Util.optionalEntitySet("ZOMBIE_HORSE", "LLAMA", "TRADER_LLAMA", "DONKEY", "MULE",
|
||||
"SKELETON_HORSE", "CAMEL")) {
|
||||
EQUIPPERS.put(type, new HorseEquipper());
|
||||
|
22
main/src/main/java/net/citizensnpcs/editor/WolfEquipper.java
Normal file
22
main/src/main/java/net/citizensnpcs/editor/WolfEquipper.java
Normal file
@ -0,0 +1,22 @@
|
||||
package net.citizensnpcs.editor;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Wolf;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
|
||||
public class WolfEquipper implements Equipper {
|
||||
@Override
|
||||
public void equip(Player equipper, NPC toEquip) {
|
||||
ItemStack hand = equipper.getInventory().getItemInHand();
|
||||
Wolf wolf = (Wolf) toEquip.getEntity();
|
||||
if (hand.getType().name().equals("WOLF_ARMOR")) {
|
||||
ItemStack armor = hand.clone();
|
||||
hand.setAmount(hand.getAmount() - 1);
|
||||
armor.setAmount(1);
|
||||
wolf.getEquipment().setChestplate(armor);
|
||||
equipper.getInventory().setItemInHand(hand);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user