mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 13:16:45 +01:00
Move orphan-handling code down to bottom
This commit is contained in:
parent
43f8f7b76e
commit
f63c5e3310
@ -353,27 +353,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
}
|
}
|
||||||
catch (SQLException e) {}
|
catch (SQLException e) {}
|
||||||
}
|
}
|
||||||
// Problem, no rows returned
|
|
||||||
result.close();
|
result.close();
|
||||||
|
|
||||||
// First, read User Id - this is to check for orphans
|
|
||||||
|
|
||||||
int id = readId(playerName);
|
|
||||||
|
|
||||||
if (id == -1) {
|
|
||||||
// There is no such user
|
|
||||||
if (create) {
|
|
||||||
newUser(playerName);
|
|
||||||
return new PlayerProfile(playerName, true);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return new PlayerProfile(playerName, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// There is such a user
|
|
||||||
writeMissingRows(id);
|
|
||||||
// Retry, and abort on re-failure
|
|
||||||
return loadPlayerProfile(playerName, false);
|
|
||||||
}
|
}
|
||||||
catch (SQLException ex) {
|
catch (SQLException ex) {
|
||||||
printErrors(ex);
|
printErrors(ex);
|
||||||
@ -389,13 +369,26 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!create) {
|
// Problem, nothing was returned
|
||||||
return new PlayerProfile(playerName, false);
|
|
||||||
|
// First, read User Id - this is to check for orphans
|
||||||
|
|
||||||
|
int id = readId(playerName);
|
||||||
|
|
||||||
|
if (id == -1) {
|
||||||
|
// There is no such user
|
||||||
|
if (create) {
|
||||||
|
newUser(playerName);
|
||||||
|
return new PlayerProfile(playerName, true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return new PlayerProfile(playerName, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
// There is such a user
|
||||||
newUser(playerName);
|
writeMissingRows(id);
|
||||||
|
// Retry, and abort on re-failure
|
||||||
return new PlayerProfile(playerName, true);
|
return loadPlayerProfile(playerName, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void convertUsers(DatabaseManager destination) {
|
public void convertUsers(DatabaseManager destination) {
|
||||||
|
Loading…
Reference in New Issue
Block a user