mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-02 16:59:35 +01:00
Add some data to NPC before NPCSpawnEvent is called
This commit is contained in:
parent
5fc5f23d8b
commit
3792407d80
@ -209,6 +209,12 @@ public class CitizensNPC extends AbstractNPC {
|
||||
|
||||
NMS.setHeadYaw(mcEntity, at.getYaw());
|
||||
|
||||
getEntity().setMetadata(NPC_METADATA_MARKER, new FixedMetadataValue(CitizensAPI.getPlugin(), true));
|
||||
|
||||
// Set the spawned state
|
||||
getTrait(CurrentLocation.class).setLocation(at);
|
||||
getTrait(Spawned.class).setSpawned(true);
|
||||
|
||||
NPCSpawnEvent spawnEvent = new NPCSpawnEvent(this, at);
|
||||
Bukkit.getPluginManager().callEvent(spawnEvent);
|
||||
|
||||
@ -218,12 +224,6 @@ public class CitizensNPC extends AbstractNPC {
|
||||
return false;
|
||||
}
|
||||
|
||||
getEntity().setMetadata(NPC_METADATA_MARKER, new FixedMetadataValue(CitizensAPI.getPlugin(), true));
|
||||
|
||||
// Set the spawned state
|
||||
getTrait(CurrentLocation.class).setLocation(at);
|
||||
getTrait(Spawned.class).setSpawned(true);
|
||||
|
||||
navigator.onSpawn();
|
||||
|
||||
// Modify NPC using traits after the entity has been created
|
||||
|
Loading…
Reference in New Issue
Block a user