Skip to content

Commit

Permalink
Don't teleport if despawned
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Jul 15, 2020
1 parent 0036c9d commit 57373a6
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions main/src/main/java/net/citizensnpcs/npc/CitizensNPC.java
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,8 @@ public boolean spawn(Location at, SpawnReason reason) {
@Override
public void teleport(Location location, TeleportCause reason) {
super.teleport(location, reason);
if (!isSpawned())
return;
Location npcLoc = getEntity().getLocation(CACHE_LOCATION);
if (isSpawned() && npcLoc.getWorld() == location.getWorld() && npcLoc.distanceSquared(location) < 1) {
NMS.setHeadYaw(getEntity(), location.getYaw());
Expand Down

0 comments on commit 57373a6

Please sign in to comment.