From fbcbfa8e86ed6321f2ae204b7e94daf1862137ed Mon Sep 17 00:00:00 2001 From: Shevchik Date: Sun, 24 Aug 2014 23:20:01 +0400 Subject: [PATCH] Fix database loading data for wrong player --- .../database/FlatfileDatabaseManager.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/database/FlatfileDatabaseManager.java b/src/main/java/com/gmail/nossr50/database/FlatfileDatabaseManager.java index 13284b993..31649c379 100644 --- a/src/main/java/com/gmail/nossr50/database/FlatfileDatabaseManager.java +++ b/src/main/java/com/gmail/nossr50/database/FlatfileDatabaseManager.java @@ -470,8 +470,22 @@ public final class FlatfileDatabaseManager implements DatabaseManager { // Find if the line contains the player we want. String[] character = line.split(":"); - if ((uuid != null && (!character[41].equalsIgnoreCase(uuid.toString()) && !character[41].equalsIgnoreCase("NULL"))) || (uuid == null && !character[0].equalsIgnoreCase(playerName))) { - continue; + if (character[41].equalsIgnoreCase("NULL")) { + //compare names because we don't have a valid uuid for that player even if input uuid is not null + if (!character[0].equalsIgnoreCase(playerName)) { + continue; + } + } else { + //if input uuid is not null then we should compare uuids + if (uuid != null) { + if (!character[41].equalsIgnoreCase(uuid.toString()) { + continue; + } + } else { + if (!character[0].equalsIgnoreCase(playerName)) { + continue; + } + } } // Update playerName in database after name change