Fix multi server function

This commit is contained in:
yuyuko 2022-06-15 08:42:03 +08:00 committed by Melledy
parent bba7afa24e
commit a329b3bdac

View File

@ -83,33 +83,33 @@ public final class DatabaseHelper {
}
public static Account getAccountByName(String username) {
return DatabaseManager.getGameDatastore().find(Account.class).filter(Filters.eq("username", username)).first();
return DatabaseManager.getAccountDatastore().find(Account.class).filter(Filters.eq("username", username)).first();
}
public static Account getAccountByToken(String token) {
if(token == null) return null;
return DatabaseManager.getGameDatastore().find(Account.class).filter(Filters.eq("token", token)).first();
return DatabaseManager.getAccountDatastore().find(Account.class).filter(Filters.eq("token", token)).first();
}
public static Account getAccountBySessionKey(String sessionKey) {
if(sessionKey == null) return null;
return DatabaseManager.getGameDatastore().find(Account.class).filter(Filters.eq("sessionKey", sessionKey)).first();
return DatabaseManager.getAccountDatastore().find(Account.class).filter(Filters.eq("sessionKey", sessionKey)).first();
}
public static Account getAccountById(String uid) {
return DatabaseManager.getGameDatastore().find(Account.class).filter(Filters.eq("_id", uid)).first();
return DatabaseManager.getAccountDatastore().find(Account.class).filter(Filters.eq("_id", uid)).first();
}
public static Account getAccountByPlayerId(int playerId) {
return DatabaseManager.getGameDatastore().find(Account.class).filter(Filters.eq("reservedPlayerId", playerId)).first();
return DatabaseManager.getAccountDatastore().find(Account.class).filter(Filters.eq("reservedPlayerId", playerId)).first();
}
public static boolean checkIfAccountExists(String name) {
return DatabaseManager.getGameDatastore().find(Account.class).filter(Filters.eq("username", name)).count() > 0;
return DatabaseManager.getAccountDatastore().find(Account.class).filter(Filters.eq("username", name)).count() > 0;
}
public static boolean checkIfAccountExists(int reservedUid) {
return DatabaseManager.getGameDatastore().find(Account.class).filter(Filters.eq("reservedPlayerId", reservedUid)).count() > 0;
return DatabaseManager.getAccountDatastore().find(Account.class).filter(Filters.eq("reservedPlayerId", reservedUid)).count() > 0;
}
public static void deleteAccount(Account target) {
@ -141,7 +141,7 @@ public final class DatabaseHelper {
}
// Finally, delete the account itself.
DatabaseManager.getGameDatastore().find(Account.class).filter(Filters.eq("id", target.getId())).delete();
DatabaseManager.getAccountDatastore().find(Account.class).filter(Filters.eq("id", target.getId())).delete();
}
public static List<Player> getAllPlayers() {