From 79f3f8e3d203ea6440014f1dd5265ea98c21063b Mon Sep 17 00:00:00 2001 From: EpicKnarvik97 Date: Sat, 5 Nov 2022 04:12:51 +0100 Subject: [PATCH] Saves tracked signs after loading Previously, if a tracked sign was removed during loading, while it wasn't added to tracked signs, tracked signs wasn't saved, so on the next startup it would be loaded again. --- .../knarcraft/paidsigns/manager/TrackedSignManager.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/knarcraft/paidsigns/manager/TrackedSignManager.java b/src/main/java/net/knarcraft/paidsigns/manager/TrackedSignManager.java index 7c9d6d2..da97300 100644 --- a/src/main/java/net/knarcraft/paidsigns/manager/TrackedSignManager.java +++ b/src/main/java/net/knarcraft/paidsigns/manager/TrackedSignManager.java @@ -77,6 +77,13 @@ public final class TrackedSignManager { for (String key : signSection.getKeys(false)) { loadSign(signSection, key); } + + //Save tracked signs in case some were invalidated after loading + try { + TrackedSignManager.saveTrackedSigns(); + } catch (IOException e) { + PaidSigns.getInstance().getLogger().log(Level.WARNING, "Unable to save tracked signs"); + } } /** @@ -120,7 +127,7 @@ public final class TrackedSignManager { * * @throws IOException

If unable to write to the data file

*/ - private static void saveTrackedSigns() throws IOException { + public static void saveTrackedSigns() throws IOException { YamlConfiguration configuration = YamlConfiguration.loadConfiguration(signsFile); ConfigurationSection signSection = configuration.createSection("trackedSigns");