From a4415dce9a84d958f16d3a64c82e47a0217785bb Mon Sep 17 00:00:00 2001 From: Aaron <51387595+AzureAaron@users.noreply.github.com> Date: Sat, 19 Jul 2025 23:30:52 -0400 Subject: Legacy Ordered Waypoint Loading Fixes - Fixes it writing the waypoints to the dwarven mines a second time instead of to the Crystal Hollows. - Fixes it erroring if the file does not exist or if it was already moved. --- src/main/java/de/hysky/skyblocker/skyblock/waypoint/Waypoints.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/main/java') diff --git a/src/main/java/de/hysky/skyblocker/skyblock/waypoint/Waypoints.java b/src/main/java/de/hysky/skyblocker/skyblock/waypoint/Waypoints.java index acefbca3..5184fdd8 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/waypoint/Waypoints.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/waypoint/Waypoints.java @@ -36,7 +36,9 @@ import org.slf4j.LoggerFactory; import java.io.*; import java.nio.charset.StandardCharsets; +import java.nio.file.FileAlreadyExistsException; import java.nio.file.Files; +import java.nio.file.NoSuchFileException; import java.nio.file.Path; import java.util.*; import java.util.function.Function; @@ -108,10 +110,11 @@ public class Waypoints { Collection waypointGroups = SKYBLOCKER_LEGACY_ORDERED_CODEC.parse(JsonOps.INSTANCE, SkyblockerMod.GSON.fromJson(reader, JsonObject.class)).resultOrPartial(LOGGER::error).orElseThrow(); for (WaypointGroup group : waypointGroups) { Waypoints.putWaypointGroup(group.withIsland(Location.DWARVEN_MINES).deepCopy()); - Waypoints.putWaypointGroup(group.withIsland(Location.DWARVEN_MINES).deepCopy()); + Waypoints.putWaypointGroup(group.withIsland(Location.CRYSTAL_HOLLOWS).deepCopy()); } Files.move(SKYBLOCKER_LEGACY_ORDERED_FILE, SkyblockerMod.CONFIG_DIR.resolve("legacy_ordered_waypoints.json")); LOGGER.info("[Skyblocker Waypoints] Successfully migrated {} ordered waypoints from {} groups to waypoints!", waypointGroups.stream().map(WaypointGroup::waypoints).mapToInt(List::size).sum(), waypointGroups.size()); + } catch (NoSuchFileException | FileAlreadyExistsException ignored) { } catch (IOException e) { LOGGER.error("[Skyblocker Waypoints] Encountered exception while loading legacy ordered waypoints", e); } -- cgit