mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-26 22:22:51 +00:00
Fix multi server function
This commit is contained in:
parent
bba7afa24e
commit
a329b3bdac
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user