!Use of newest methods of ML for data saving

This commit is contained in:
Jules 2023-06-18 16:51:08 +02:00
parent 59816c163d
commit 74a170e66c
2 changed files with 2 additions and 15 deletions

View File

@ -275,25 +275,12 @@ public class MMOCore extends JavaPlugin {
@Override
public void onDisable() {
// Executes all the pending asynchronous task (like saving the playerData)
Bukkit.getScheduler().getPendingTasks().forEach(worker -> {
if (worker.getOwner().equals(this)) {
((Runnable) worker).run();
}
});
// Save player data
for (PlayerData data : PlayerData.getAll())
if (data.isSynchronized()) {
data.close();
dataProvider.getDataManager().getDataHandler().saveData(data, true);
}
// Save guild info
for (Guild guild : dataProvider.getGuildManager().getAll())
dataProvider.getGuildManager().save(guild);
// Close MySQL data provider (memory leaks)
playerDataManager.saveAll(false);
playerDataManager.getDataHandler().close();
// Reset active blocks

View File

@ -92,7 +92,7 @@ public class ExportDataTreeNode extends CommandTreeNode {
MMOCore.plugin.dataProvider.getDataManager().getDataHandler().loadData(offlinePlayerData);
// Player data is loaded, now it gets saved through SQL
sqlHandler.saveData(offlinePlayerData, true);
sqlHandler.saveData(offlinePlayerData, false);
} catch (RuntimeException exception) {
errorCount++;
exception.printStackTrace();