From 0648079232a1aec78141678313828b11d28899fc Mon Sep 17 00:00:00 2001 From: Indyuce Date: Sat, 28 May 2022 14:28:18 +0200 Subject: [PATCH] Fixed waypoint path calculation --- src/main/java/net/Indyuce/mmocore/waypoint/Waypoint.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/net/Indyuce/mmocore/waypoint/Waypoint.java b/src/main/java/net/Indyuce/mmocore/waypoint/Waypoint.java index e8d2695f..7391f8a5 100644 --- a/src/main/java/net/Indyuce/mmocore/waypoint/Waypoint.java +++ b/src/main/java/net/Indyuce/mmocore/waypoint/Waypoint.java @@ -140,6 +140,10 @@ public class Waypoint extends PostLoadObject implements Unlockable { while (pointsToCheck.size() != 0) { WaypointPath checked = pointsToCheck.get(0); pointsToCheck.remove(0); + // If the point has already been checked, pass + if (checkedPoints.contains(checked.getFinalWaypoint())) + continue; + paths.add(checked); checkedPoints.add(checked.getFinalWaypoint()); @@ -165,6 +169,10 @@ public class Waypoint extends PostLoadObject implements Unlockable { while (pointsToCheck.size() != 0) { WaypointPath checked = pointsToCheck.get(0); pointsToCheck.remove(0); + // If the point has already been checked, pass + if (checkedPoints.contains(checked.getFinalWaypoint())) + continue; + paths.add(checked); checkedPoints.add(checked.getFinalWaypoint());