Commit 5565a13d authored by AnimeGitB's avatar AnimeGitB
Browse files

Fix account deletion

parent dd10dcc0
...@@ -99,10 +99,6 @@ public final class AccountCommand implements CommandHandler { ...@@ -99,10 +99,6 @@ public final class AccountCommand implements CommandHandler {
return; return;
} }
// Make sure player isn't online as we delete their account.
kickAccount(toDelete);
// Finally, we do the actual deletion.
DatabaseHelper.deleteAccount(toDelete); DatabaseHelper.deleteAccount(toDelete);
CommandHandler.sendMessage(sender, translate(sender, "commands.account.delete")); CommandHandler.sendMessage(sender, translate(sender, "commands.account.delete"));
return; return;
......
...@@ -123,10 +123,10 @@ public final class DatabaseHelper { ...@@ -123,10 +123,10 @@ public final class DatabaseHelper {
Player player = Grasscutter.getGameServer().getPlayerByAccountId(target.getId()); Player player = Grasscutter.getGameServer().getPlayerByAccountId(target.getId());
if (player != null) {
// Close session first // Close session first
if (player != null) {
player.getSession().close(); player.getSession().close();
}
// Delete data from collections // Delete data from collections
DatabaseManager.getGameDatabase().getCollection("activities").deleteMany(eq("uid",player.getUid())); DatabaseManager.getGameDatabase().getCollection("activities").deleteMany(eq("uid",player.getUid()));
DatabaseManager.getGameDatabase().getCollection("homes").deleteMany(eq("ownerUid",player.getUid())); DatabaseManager.getGameDatabase().getCollection("homes").deleteMany(eq("ownerUid",player.getUid()));
...@@ -145,7 +145,6 @@ public final class DatabaseHelper { ...@@ -145,7 +145,6 @@ public final class DatabaseHelper {
// Delete the player last. // Delete the player last.
DatabaseManager.getGameDatastore().find(Player.class).filter(Filters.eq("id", player.getUid())).delete(); DatabaseManager.getGameDatastore().find(Player.class).filter(Filters.eq("id", player.getUid())).delete();
}
// Finally, delete the account itself. // Finally, delete the account itself.
DatabaseManager.getAccountDatastore().find(Account.class).filter(Filters.eq("id", target.getId())).delete(); DatabaseManager.getAccountDatastore().find(Account.class).filter(Filters.eq("id", target.getId())).delete();
......
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