Do not mark a PlayerProfile as clean if it failed to save

DatabaseManager.saveUser() now returns a success value, which is used by PlayerProfile to determine whether or not it should be considered clean.
This commit is contained in:
riking
2013-10-05 15:18:10 -07:00
committed by TfT_02
parent f75fe3cc89
commit c9858dfd49
4 changed files with 31 additions and 22 deletions

View File

@ -203,7 +203,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
return worked;
}
public void saveUser(PlayerProfile profile) {
public boolean saveUser(PlayerProfile profile) {
String playerName = profile.getPlayerName();
BufferedReader in = null;
@ -272,9 +272,11 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
// Write the new file
out = new FileWriter(usersFilePath);
out.write(writer.toString());
return true;
}
catch (Exception e) {
e.printStackTrace();
return false;
}
finally {
tryClose(in);
@ -434,11 +436,6 @@ public final class FlatfileDatabaseManager implements DatabaseManager {
}
}
public boolean checkConnected() {
// Not implemented
return true;
}
public List<String> getStoredUsers() {
ArrayList<String> users = new ArrayList<String>();
BufferedReader in = null;