From 69ebde052d2385c7c32dbf8f4f787a7c460c5064 Mon Sep 17 00:00:00 2001 From: TfT_02 Date: Sat, 12 Jul 2014 17:10:05 +0200 Subject: [PATCH] Load UUID with SQL --- .../gmail/nossr50/database/SQLDatabaseManager.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/database/SQLDatabaseManager.java b/src/main/java/com/gmail/nossr50/database/SQLDatabaseManager.java index 3df35c64d..91554e6a1 100644 --- a/src/main/java/com/gmail/nossr50/database/SQLDatabaseManager.java +++ b/src/main/java/com/gmail/nossr50/database/SQLDatabaseManager.java @@ -366,7 +366,12 @@ public final class SQLDatabaseManager implements DatabaseManager { private PlayerProfile loadPlayerProfile(String playerName, String uuid, boolean create, boolean retry) { if (!checkConnected()) { - return new PlayerProfile(playerName, false); // return fake profile if not connected + // return fake profile if not connected + if (uuid.isEmpty()) { + return new PlayerProfile(playerName, false); + } + + return new PlayerProfile(playerName, UUID.fromString(uuid), false); } PreparedStatement statement = null; @@ -1270,7 +1275,7 @@ public final class SQLDatabaseManager implements DatabaseManager { Map skillsXp = new HashMap(); // Skill & XP Map skillsDATS = new HashMap(); // Ability & Cooldown MobHealthbarType mobHealthbarType; - UUID uuid = null; + UUID uuid; final int OFFSET_SKILLS = 0; // TODO update these numbers when the query changes (a new skill is added) final int OFFSET_XP = 13; @@ -1326,9 +1331,10 @@ public final class SQLDatabaseManager implements DatabaseManager { } try { - UUID.fromString(result.getString(OFFSET_OTHER + 3)); + uuid = UUID.fromString(result.getString(OFFSET_OTHER + 3)); } catch (Exception e) { + uuid = null; } return new PlayerProfile(playerName, uuid, skills, skillsXp, skillsDATS, mobHealthbarType);