diff --git a/main/src/main/java/net/citizensnpcs/npc/CitizensNPC.java b/main/src/main/java/net/citizensnpcs/npc/CitizensNPC.java index 18b525cdb..6e634a6d3 100644 --- a/main/src/main/java/net/citizensnpcs/npc/CitizensNPC.java +++ b/main/src/main/java/net/citizensnpcs/npc/CitizensNPC.java @@ -323,6 +323,7 @@ public class CitizensNPC extends AbstractNPC { ex.printStackTrace(); } } + data().set(NPC.Metadata.NPC_SPAWNING_IN_PROGRESS, true); boolean wasLoaded = Messaging.isDebugging() ? Util.isLoaded(at) : false; boolean couldSpawn = entityController.spawn(at); @@ -334,10 +335,10 @@ public class CitizensNPC extends AbstractNPC { // we need to wait before trying to spawn entityController.remove(); Bukkit.getPluginManager().callEvent(new NPCNeedsRespawnEvent(this, at)); + data().remove(NPC.Metadata.NPC_SPAWNING_IN_PROGRESS); return false; } // Spawning the entity will initially create an entity tracker that is not controlled by Citizens - data().set(NPC.Metadata.NPC_SPAWNING_IN_PROGRESS, true); NMS.setLocationDirectly(getEntity(), at); NMS.setHeadAndBodyYaw(getEntity(), at.getYaw());