Skip to content

Commit

Permalink
Update EventListen.java
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Aug 25, 2015
1 parent 03ef04a commit 0ca55e5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/net/citizensnpcs/EventListen.java
Expand Up @@ -216,8 +216,8 @@ public void onEntityDeath(EntityDeathEvent event) {
if (npc == null) {
return;
}
Bukkit.getPluginManager().callEvent(new NPCDeathEvent(npc, event));
final Location location = npc.getEntity().getLocation();
Bukkit.getPluginManager().callEvent(new NPCDeathEvent(npc, event));
npc.despawn(DespawnReason.DEATH);

if (npc.data().has(NPC.SCOREBOARD_FAKE_TEAM_NAME_METADATA)) {
Expand All @@ -235,7 +235,7 @@ public void onEntityDeath(EntityDeathEvent event) {
Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), new Runnable() {
@Override
public void run() {
if (!npc.isSpawned()) {
if (!npc.isSpawned() && npc.getOwningRegistry().getByUniqueId(npc.getUniqueId()) == npc) {
npc.spawn(location);
}
}
Expand Down

0 comments on commit 0ca55e5

Please sign in to comment.