diff --git a/src/main/java/net/citizensnpcs/trait/waypoint/LinearWaypointProvider.java b/src/main/java/net/citizensnpcs/trait/waypoint/LinearWaypointProvider.java index bbfb7e09c..3e7e22ec9 100644 --- a/src/main/java/net/citizensnpcs/trait/waypoint/LinearWaypointProvider.java +++ b/src/main/java/net/citizensnpcs/trait/waypoint/LinearWaypointProvider.java @@ -400,11 +400,14 @@ public class LinearWaypointProvider implements WaypointProvider { return false; this.selector = selector; Waypoint next = itr.next(); - if (npc.getBukkitEntity().getLocation().distanceSquared(next.getLocation()) < 3) + Location npcLoc = npc.getBukkitEntity().getLocation(cachedLocation); + if (npcLoc.getWorld() != next.getLocation().getWorld() || npcLoc.distanceSquared(next.getLocation()) < 3) return false; currentDestination = next; getNavigator().setTarget(currentDestination.getLocation()); return true; } + + private final Location cachedLocation = new Location(null, 0, 0, 0); } } \ No newline at end of file