forked from Upstream/mmocore
!Use of newest methods of ML for data saving
This commit is contained in:
parent
59816c163d
commit
74a170e66c
@ -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
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user