Force save on initial conversion.

This commit is contained in:
Brianna 2019-11-05 06:10:18 -05:00
parent 14151f28c2
commit fc0364a139
3 changed files with 7 additions and 9 deletions

View File

@ -167,15 +167,14 @@ public class UltimateKits extends SongodaPlugin {
displayItemHandler.start(); displayItemHandler.start();
particleHandler.start(); particleHandler.start();
Bukkit.getScheduler().scheduleSyncRepeatingTask(this, this::saveKits, 6000, 6000); Bukkit.getScheduler().scheduleSyncRepeatingTask(this, () -> saveKits(false), 6000, 6000);
} }
@Override @Override
public void onPluginDisable() { public void onPluginDisable() {
saveKits(); saveKits(false);
dataFile.save(); dataFile.save();
this.dataManager.bulkUpdateBlockData(this.getKitManager().getKitLocations()); this.dataManager.bulkUpdateBlockData(this.getKitManager().getKitLocations());
saveKits();
kitManager.clearKits(); kitManager.clearKits();
HologramManager.removeAllHolograms(); HologramManager.removeAllHolograms();
} }
@ -190,12 +189,11 @@ public class UltimateKits extends SongodaPlugin {
this.setLocale(Settings.LANGUGE_MODE.getString(), true); this.setLocale(Settings.LANGUGE_MODE.getString(), true);
this.dataManager.bulkUpdateBlockData(this.getKitManager().getKitLocations()); this.dataManager.bulkUpdateBlockData(this.getKitManager().getKitLocations());
kitConfig.load();
loadKits(); loadKits();
} }
void loadKits() { void loadKits() {
kitConfig.load();
Bukkit.getScheduler().runTaskLater(this, () -> { Bukkit.getScheduler().runTaskLater(this, () -> {
//Empty kits from manager. //Empty kits from manager.
@ -391,8 +389,8 @@ public class UltimateKits extends SongodaPlugin {
/* /*
* Saves registered kits to file. * Saves registered kits to file.
*/ */
public void saveKits() { public void saveKits(boolean force) {
if (!loaded) return; if (!loaded && !force) return;
// Hot fix for kit file resets. // Hot fix for kit file resets.
if (kitConfig.contains("Kits")) if (kitConfig.contains("Kits"))

View File

@ -48,7 +48,7 @@ public class Convert {
} }
kitObj.setDelay(hook.getDelay(kit)); kitObj.setDelay(hook.getDelay(kit));
} }
UltimateKits.getInstance().saveKits(); UltimateKits.getInstance().saveKits(true);
} }
private static boolean isInJsonFormat() { private static boolean isInJsonFormat() {

View File

@ -224,7 +224,7 @@ public class Kit {
} }
} }
contents = list; contents = list;
plugin.saveKits(); plugin.saveKits(false);
} }