Commit 8a3d6e3d authored by yuyuko's avatar yuyuko Committed by Melledy
Browse files

Fix multi server function

parent ebab89d4
......@@ -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() {
......
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