From 026e3fc17ef5c1aa2eb707a21079fe1f218fd1eb Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Thu, 27 Jan 2022 13:18:54 +0000 Subject: [PATCH] Process chunks in order when regenerating all roads --- .../main/java/com/plotsquared/core/command/DebugExec.java | 3 ++- .../java/com/plotsquared/core/generator/HybridUtils.java | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Core/src/main/java/com/plotsquared/core/command/DebugExec.java b/Core/src/main/java/com/plotsquared/core/command/DebugExec.java index 274f34cc8..d8ab55bd6 100644 --- a/Core/src/main/java/com/plotsquared/core/command/DebugExec.java +++ b/Core/src/main/java/com/plotsquared/core/command/DebugExec.java @@ -49,6 +49,7 @@ import org.checkerframework.checker.nullness.qual.NonNull; import java.util.Arrays; import java.util.Collection; import java.util.HashSet; +import java.util.LinkedHashSet; import java.util.List; import java.util.Locale; import java.util.stream.Collectors; @@ -207,7 +208,7 @@ public class DebugExec extends SubCommand { } boolean result; if (HybridUtils.regions != null) { - result = this.hybridUtils.scheduleRoadUpdate(area, HybridUtils.regions, 0, new HashSet<>()); + result = this.hybridUtils.scheduleRoadUpdate(area, HybridUtils.regions, 0, new LinkedHashSet<>()); } else { result = this.hybridUtils.scheduleRoadUpdate(area, 0); } diff --git a/Core/src/main/java/com/plotsquared/core/generator/HybridUtils.java b/Core/src/main/java/com/plotsquared/core/generator/HybridUtils.java index b265cdf0f..f47b20c8f 100644 --- a/Core/src/main/java/com/plotsquared/core/generator/HybridUtils.java +++ b/Core/src/main/java/com/plotsquared/core/generator/HybridUtils.java @@ -74,6 +74,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.Iterator; +import java.util.LinkedHashSet; import java.util.List; import java.util.Set; import java.util.concurrent.atomic.AtomicBoolean; @@ -86,7 +87,7 @@ public class HybridUtils { public static HybridUtils manager; public static Set regions; public static int height; - public static Set chunks = new HashSet<>(); + public static Set chunks = new LinkedHashSet<>(); public static PlotArea area; public static boolean UPDATE = false; @@ -412,7 +413,7 @@ public class HybridUtils { } HybridUtils.UPDATE = true; Set regions = this.worldUtil.getChunkChunks(area.getWorldName()); - return scheduleRoadUpdate(area, regions, extend, new HashSet<>()); + return scheduleRoadUpdate(area, regions, extend, new LinkedHashSet<>()); } public boolean scheduleSingleRegionRoadUpdate(Plot plot, int extend) { @@ -422,7 +423,7 @@ public class HybridUtils { HybridUtils.UPDATE = true; Set regions = new HashSet<>(); regions.add(RegionManager.getRegion(plot.getCenterSynchronous())); - return scheduleRoadUpdate(plot.getArea(), regions, extend, new HashSet<>()); + return scheduleRoadUpdate(plot.getArea(), regions, extend, new LinkedHashSet<>()); } public boolean scheduleRoadUpdate(