Skip to content

Commit

Permalink
Small fix to Health trait.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidcernat committed Mar 13, 2013
1 parent c24fa14 commit 1a4a30a
Showing 1 changed file with 4 additions and 1 deletion.
Expand Up @@ -197,16 +197,18 @@ public void die()
// Set the player as the killer of the NPC, for listeners
if (player != null)
((CraftLivingEntity) npc.getBukkitEntity())
.getHandle().killer = (EntityHuman) ((CraftLivingEntity) ((Entity) player)).getHandle();
.getHandle().killer = (EntityHuman) ((CraftLivingEntity) player).getHandle();

setHealth();

EntityDeathEvent entityDeath = new EntityDeathEvent(npc.getBukkitEntity(), null);
NPCDeathEvent npcDeath = new NPCDeathEvent(npc, entityDeath);

DenizenAPI.getCurrentInstance().getServer()
.getPluginManager().callEvent(npcDeath);
DenizenAPI.getCurrentInstance().getServer()
.getPluginManager().callEvent(entityDeath);

npc.despawn(DespawnReason.DEATH);
}

Expand All @@ -222,6 +224,7 @@ public void onDeath(EntityDamageEvent event) {
return;

dying = true;
player = null;

String deathCause = event.getCause().toString().toLowerCase().replace('_', ' ');

Expand Down

0 comments on commit 1a4a30a

Please sign in to comment.