mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 05:06:45 +01:00
save() added to PlayerProfile, won't compile as is. But this should do the trick for us.
This commit is contained in:
parent
04c385d0dc
commit
3a85abadfa
@ -235,6 +235,33 @@ class PlayerList
|
||||
} catch (Exception e) {
|
||||
log.log(Level.SEVERE, "Exception while reading " + location + " (Are you sure you formatted it correctly?)", e);
|
||||
}
|
||||
//=====================================================================
|
||||
// Function: save
|
||||
// Input: none
|
||||
// Output: Writes current values of PlayerProfile to disk
|
||||
// Use: Call this function to save current values
|
||||
//=====================================================================
|
||||
public void save(){
|
||||
try {
|
||||
String location = "vminecraftusers.txt";
|
||||
BufferedWriter bw = new BufferedWriter(new FileWriter(location, true));
|
||||
Scanner scanner = new Scanner(new File(location));
|
||||
while (scanner.hasNextLine()) {
|
||||
String line = scanner.nextLine();
|
||||
if (line.startsWith("#") || line.equals("") || line.startsWith("")) {
|
||||
continue;
|
||||
}
|
||||
String[] split = line.split(":");
|
||||
if (!split[0].equalsIgnoreCase(playerName.toString())) {
|
||||
continue;
|
||||
}
|
||||
bw.write(playerName + ":" + nickName + ":" + suffix + ":" + tag + ":" + ignoreList + ":" + aliasList);
|
||||
}
|
||||
scanner.close();
|
||||
} catch (Exception e) {
|
||||
String location = "vminecraftusers.txt";
|
||||
log.log(Level.SEVERE, "Exception while writing to " + location + " (Are you sure you formatted it correctly?)", e);
|
||||
}
|
||||
}
|
||||
|
||||
//=====================================================================
|
||||
|
Loading…
Reference in New Issue
Block a user