Ensure player data is completely saved on shutdown.
Changed shutdown data save to synchronous (from multithreaded). Takes longer but guarantees all data gets saved.
This commit is contained in:
@@ -564,6 +564,12 @@ public abstract class DataStore
|
||||
return result;
|
||||
}
|
||||
|
||||
//saves changes to player data to secondary storage. MUST be called after you're done making changes, otherwise a reload will lose them
|
||||
public void savePlayerDataSync(UUID playerID, PlayerData playerData)
|
||||
{
|
||||
this.asyncSavePlayerData(playerID, playerData);
|
||||
}
|
||||
|
||||
//saves changes to player data to secondary storage. MUST be called after you're done making changes, otherwise a reload will lose them
|
||||
public void savePlayerData(UUID playerID, PlayerData playerData)
|
||||
{
|
||||
|
||||
@@ -2226,7 +2226,7 @@ public class GriefPrevention extends JavaPlugin
|
||||
Player player = players[i];
|
||||
UUID playerID = player.getUniqueId();
|
||||
PlayerData playerData = this.dataStore.getPlayerData(playerID);
|
||||
this.dataStore.savePlayerData(playerID, playerData);
|
||||
this.dataStore.savePlayerDataSync(playerID, playerData);
|
||||
}
|
||||
|
||||
this.dataStore.close();
|
||||
|
||||
Reference in New Issue
Block a user