Load UUID with SQL

This commit is contained in:
TfT_02 2014-07-12 17:10:05 +02:00
parent 072e7c8b19
commit 69ebde052d

View File

@ -366,7 +366,12 @@ public final class SQLDatabaseManager implements DatabaseManager {
private PlayerProfile loadPlayerProfile(String playerName, String uuid, boolean create, boolean retry) { private PlayerProfile loadPlayerProfile(String playerName, String uuid, boolean create, boolean retry) {
if (!checkConnected()) { 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; PreparedStatement statement = null;
@ -1270,7 +1275,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
Map<SkillType, Float> skillsXp = new HashMap<SkillType, Float>(); // Skill & XP Map<SkillType, Float> skillsXp = new HashMap<SkillType, Float>(); // Skill & XP
Map<AbilityType, Integer> skillsDATS = new HashMap<AbilityType, Integer>(); // Ability & Cooldown Map<AbilityType, Integer> skillsDATS = new HashMap<AbilityType, Integer>(); // Ability & Cooldown
MobHealthbarType mobHealthbarType; 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_SKILLS = 0; // TODO update these numbers when the query changes (a new skill is added)
final int OFFSET_XP = 13; final int OFFSET_XP = 13;
@ -1326,9 +1331,10 @@ public final class SQLDatabaseManager implements DatabaseManager {
} }
try { try {
UUID.fromString(result.getString(OFFSET_OTHER + 3)); uuid = UUID.fromString(result.getString(OFFSET_OTHER + 3));
} }
catch (Exception e) { catch (Exception e) {
uuid = null;
} }
return new PlayerProfile(playerName, uuid, skills, skillsXp, skillsDATS, mobHealthbarType); return new PlayerProfile(playerName, uuid, skills, skillsXp, skillsDATS, mobHealthbarType);