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:
ryanhamshire 2014-10-16 19:17:44 -07:00
parent 370f94a531
commit a3d4a39e86
2 changed files with 7 additions and 1 deletions

View File

@ -564,6 +564,12 @@ public abstract class DataStore
return result; 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 //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) public void savePlayerData(UUID playerID, PlayerData playerData)
{ {

View File

@ -2226,7 +2226,7 @@ public class GriefPrevention extends JavaPlugin
Player player = players[i]; Player player = players[i];
UUID playerID = player.getUniqueId(); UUID playerID = player.getUniqueId();
PlayerData playerData = this.dataStore.getPlayerData(playerID); PlayerData playerData = this.dataStore.getPlayerData(playerID);
this.dataStore.savePlayerData(playerID, playerData); this.dataStore.savePlayerDataSync(playerID, playerData);
} }
this.dataStore.close(); this.dataStore.close();