diff --git a/Changelog.txt b/Changelog.txt index 80254b1b8..9f22ab842 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,3 +1,10 @@ +Version 2.1.179 + Fixed a bug for FlatFile databases where some players with changed nicknames would have their levels not loaded upon login (possibly wiping their data) + + NOTES: + Players affected by this bug (introduced in 2.1.177) may have their data lost, but this patch reverts the change which caused this bug. + I suspect their data isn't lost and may be restored after this patch is loaded up, however if it is lost mcMMO makes regular backups so you can load one of those (check /plugins/mcMMO/) or manually edit their levels via MMOEDIT as a solution of sorts. + Version 2.1.178 Item replacement in vanilla fishing override back to SALMON from AIR (see notes) diff --git a/src/main/java/com/gmail/nossr50/database/FlatfileDatabaseManager.java b/src/main/java/com/gmail/nossr50/database/FlatfileDatabaseManager.java index efa77fb9a..afd53ecc7 100644 --- a/src/main/java/com/gmail/nossr50/database/FlatfileDatabaseManager.java +++ b/src/main/java/com/gmail/nossr50/database/FlatfileDatabaseManager.java @@ -477,7 +477,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager { } public PlayerProfile loadPlayerProfile(String playerName, UUID uuid, boolean create) { - boolean updateRequired = false; +// boolean updateRequired = false; BufferedReader in = null; String usersFilePath = mcMMO.getUsersFilePath(); @@ -505,12 +505,13 @@ public final class FlatfileDatabaseManager implements DatabaseManager { // Update playerName in database after name change if (!character[USERNAME].equalsIgnoreCase(playerName)) { -// mcMMO.p.debug("Name change detected: " + character[USERNAME] + " => " + playerName); + //TODO: A proper fix for changed names + mcMMO.p.debug("Name change detected: " + character[USERNAME] + " => " + playerName); character[USERNAME] = playerName; - updateRequired = true; //Flag profile to update +// updateRequired = true; //Flag profile to update } - return loadFromLine(character, updateRequired); + return loadFromLine(character); } // Didn't find the player, create a new one @@ -565,7 +566,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager { String[] character = line.split(":"); try { - destination.saveUser(loadFromLine(character, false)); + destination.saveUser(loadFromLine(character)); } catch (Exception e) { e.printStackTrace(); @@ -1148,7 +1149,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager { } } - private PlayerProfile loadFromLine(@NotNull String[] character, boolean updateRequired) { + private PlayerProfile loadFromLine(@NotNull String[] character) { Map skills = getSkillMapFromLine(character); // Skill levels Map skillsXp = new EnumMap<>(PrimarySkillType.class); // Skill & XP Map skillsDATS = new EnumMap<>(SuperAbilityType.class); // Ability & Cooldown @@ -1216,10 +1217,10 @@ public final class FlatfileDatabaseManager implements DatabaseManager { PlayerProfile playerProfile = new PlayerProfile(character[USERNAME], uuid, skills, skillsXp, skillsDATS, mobHealthbarType, scoreboardTipsShown, uniquePlayerDataMap); - if(updateRequired) { - playerProfile.markProfileDirty(); - playerProfile.scheduleSyncSave(); //Save profile since fields have changed - } +// if(updateRequired) { +// playerProfile.markProfileDirty(); +// playerProfile.scheduleSyncSave(); //Save profile since fields have changed +// } return new PlayerProfile(character[USERNAME], uuid, skills, skillsXp, skillsDATS, mobHealthbarType, scoreboardTipsShown, uniquePlayerDataMap); }