Skip to content

Commit

Permalink
teleport should check cross-world
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Jul 10, 2020
1 parent f3986ec commit c60e18b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion main/src/main/java/net/citizensnpcs/npc/CitizensNPC.java
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,8 @@ public boolean spawn(Location at, SpawnReason reason) {
@Override
public void teleport(Location location, TeleportCause reason) {
super.teleport(location, reason);
if (isSpawned() && getEntity().getLocation(CACHE_LOCATION).distanceSquared(location) < 1) {
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 c60e18b

Please sign in to comment.