From d0b766a2d3058cc98ccffa9b1e4f30216813ed28 Mon Sep 17 00:00:00 2001 From: GJ Date: Fri, 21 Feb 2014 11:38:22 -0500 Subject: [PATCH] Fixed bug with updating (very) old user data. --- Changelog.txt | 1 + .../database/FlatfileDatabaseManager.java | 22 +++++++++++-------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index 3eedba871..f03e7b4d6 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -21,6 +21,7 @@ Version 1.4.08-dev + Added new experience bonus perk 'mcmmo.perks.xp.customboost.' multiplies incoming XP by the boost amount defined in the experience config + Added Ender Dragon, Wither, and Witch to combat experience multipliers - they do not give XP by default + Added support for multiple mod config files, naming can be done as either armor..yml or .armor.yml + = Fixed bug with updating (very) old user data. = Fixed bug with checking maximum durability of mod items. = Fixed exploit involving Call of The Wild. = Fixed bug where LeafBlower permissions were ignored diff --git a/src/main/java/com/gmail/nossr50/database/FlatfileDatabaseManager.java b/src/main/java/com/gmail/nossr50/database/FlatfileDatabaseManager.java index abd524ddb..8d17bd6ac 100644 --- a/src/main/java/com/gmail/nossr50/database/FlatfileDatabaseManager.java +++ b/src/main/java/com/gmail/nossr50/database/FlatfileDatabaseManager.java @@ -604,7 +604,7 @@ public final class FlatfileDatabaseManager implements DatabaseManager { // Length checks depend on last character being ':' if (line.charAt(line.length() - 1) != ':') { - line = line + ":"; + line = line.concat(":"); } String[] character = line.split(":"); @@ -621,12 +621,23 @@ public final class FlatfileDatabaseManager implements DatabaseManager { String oldVersion = null; + if (character.length <= 33) { + // Introduction of HUDType + // Version 1.1.06 + // commit 78f79213cdd7190cd11ae54526f3b4ea42078e8a + line = line.concat(" :"); + character = line.split(":"); + oldVersion = "1.1.06"; + } + if (!character[33].isEmpty()) { // Removal of Spout Support // Version 1.4.07-dev2 // commit 7bac0e2ca5143bce84dc160617fed97f0b1cb968 line = line.replace(character[33], ""); - oldVersion = "1.4.07"; + if (oldVersion == null) { + oldVersion = "1.4.07"; + } } // If they're valid, rewrite them to the file. @@ -637,13 +648,6 @@ public final class FlatfileDatabaseManager implements DatabaseManager { StringBuilder newLine = new StringBuilder(line); - if (character.length <= 33) { - // Introduction of HUDType - // Version 1.1.06 - // commit 78f79213cdd7190cd11ae54526f3b4ea42078e8a - newLine.append(":"); - oldVersion = "1.1.06"; - } if (character.length <= 35) { // Introduction of Fishing // Version 1.2.00