teleport should check cross-world

This commit is contained in:
fullwall 2020-07-11 00:44:40 +08:00
parent f3986ec9cc
commit c60e18bd87
1 changed files with 2 additions and 1 deletions

View File

@ -326,7 +326,8 @@ public class CitizensNPC extends AbstractNPC {
@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());
}
}