Move NPC_SPAWNING_IN_PROGRESS metadata

This commit is contained in:
fullwall 2024-08-26 23:45:11 +08:00
parent efb590c45b
commit a1d208fe1e

View File

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