Commit e1688c86 authored by ImmuState's avatar ImmuState Committed by Melledy
Browse files

Make sure no player already has the reserved UID when creating and account.

parent 7f3e8984
...@@ -38,10 +38,18 @@ public final class DatabaseHelper { ...@@ -38,10 +38,18 @@ public final class DatabaseHelper {
if (reservedId == GameConstants.SERVER_CONSOLE_UID) { if (reservedId == GameConstants.SERVER_CONSOLE_UID) {
return null; return null;
} }
// Make sure not other accounts has that id as its reservedPlayerId
exists = DatabaseHelper.getAccountByPlayerId(reservedId); exists = DatabaseHelper.getAccountByPlayerId(reservedId);
if (exists != null) { if (exists != null) {
return null; return null;
} }
// Make sure no existing player already has this id.
Player existsPlayer = DatabaseHelper.getPlayerByUid(reservedId);
if (existsPlayer != null) {
return null;
}
} }
// Account // Account
......
...@@ -103,7 +103,7 @@ ...@@ -103,7 +103,7 @@
"account": { "account": {
"modify": "Modify user accounts", "modify": "Modify user accounts",
"invalid": "Invalid UID.", "invalid": "Invalid UID.",
"exists": "Account already exists.", "exists": "An account with this username and/or UID already exists.",
"create": "Account created with UID %s.", "create": "Account created with UID %s.",
"delete": "Account deleted.", "delete": "Account deleted.",
"no_account": "Account not found.", "no_account": "Account not found.",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment