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

This commit is contained in:
ImmuState 2022-06-01 14:55:33 -07:00 committed by Melledy
parent 3312a894ff
commit f6d0192818
2 changed files with 9 additions and 1 deletions

View File

@ -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

View File

@ -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.",