mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-22 18:45:29 +01:00
Add NPC_METADATA_MARKER before teleporting
This solves an issue I have, namely that I cannot check if a "Player" is an NPC on a PlayerTeleportEvent when the NPC is spawning. Fixes https://bitbucket.org/Lolmewn/stats/issues/292/citizen-denizen-npc-issue
This commit is contained in:
parent
a18b55b5f7
commit
5734620ec8
@ -196,6 +196,8 @@ public class CitizensNPC extends AbstractNPC {
|
||||
|
||||
entityController.spawn(at, this);
|
||||
|
||||
getEntity().setMetadata(NPC_METADATA_MARKER, new FixedMetadataValue(CitizensAPI.getPlugin(), true));
|
||||
|
||||
boolean couldSpawn = !Util.isLoaded(at) ? false : NMS.addEntityToWorld(getEntity(), SpawnReason.CUSTOM);
|
||||
|
||||
// send skin packets, if applicable, before other NMS packets are sent
|
||||
@ -219,8 +221,6 @@ public class CitizensNPC extends AbstractNPC {
|
||||
|
||||
NMS.setHeadYaw(getEntity(), 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);
|
||||
|
Loading…
Reference in New Issue
Block a user