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

View File

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

View File

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