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.
This commit is contained in:
Kristian Knarvik 2022-11-05 04:12:51 +01:00
parent d50d9b42c4
commit 79f3f8e3d2

View File

@ -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 <p>If unable to write to the data file</p>
*/
private static void saveTrackedSigns() throws IOException {
public static void saveTrackedSigns() throws IOException {
YamlConfiguration configuration = YamlConfiguration.loadConfiguration(signsFile);
ConfigurationSection signSection = configuration.createSection("trackedSigns");