Fix CITIZENS-335

This commit is contained in:
fullwall 2012-12-18 20:38:39 +08:00
parent 6cc965f108
commit fc0bbc7866
5 changed files with 4 additions and 3 deletions

View File

@ -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);
}

View File

@ -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);

View File

@ -78,6 +78,7 @@ public class GenericEquipper implements Equipper {
clone.setAmount(1);
trait.set(slot, clone);
hand.setAmount(hand.getAmount() - 1);
equipper.setItemInHand(hand);
}
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}