This commit is contained in:
fullwall 2012-05-14 19:45:16 +08:00
parent 5ea3f32f76
commit bcc36a3076

View File

@ -89,14 +89,12 @@ public class EventListen implements Listener {
NPC npc = npcManager.getNPC(event.getEntity());
if (event instanceof EntityDamageByEntityEvent) {
EntityDamageByEntityEvent e = (EntityDamageByEntityEvent) event;
NPCDamageByEntityEvent damageEvent = new NPCDamageByEntityEvent(npc, (EntityDamageByEntityEvent) event);
Bukkit.getPluginManager().callEvent(damageEvent);
NPCDamageByEntityEvent damageEvent = new NPCDamageByEntityEvent(npc, e);
Bukkit.getPluginManager().callEvent(event);
if (!damageEvent.isCancelled() || !(e.getDamager() instanceof Player))
if (!damageEvent.isCancelled() || !(damageEvent.getDamager() instanceof Player))
return;
Player damager = (Player) e.getDamager();
Player damager = (Player) damageEvent.getDamager();
// Call left-click event
NPCLeftClickEvent leftClickEvent = new NPCLeftClickEvent(npc, damager);