Skip to content

Commit c2f5446

Browse files
committed
Implemented requested changes for pull request #1283
1 parent 661b426 commit c2f5446

2 files changed

Lines changed: 17 additions & 8 deletions

File tree

bukkit/src/main/java/com/github/games647/fastlogin/bukkit/command/DeleteCommand.java

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,19 +55,28 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
5555
return true;
5656
}
5757

58+
if (plugin.getBungeeManager().isEnabled()) {
59+
sender.sendMessage("Error: Cannot delete profile entries when using BungeeCord!");
60+
return false;
61+
}
62+
5863
if (args.length < 1) {
5964
sender.sendMessage("Error: Must supply username to delete!");
6065
return false;
6166
}
6267

63-
int count = plugin.getCore().getStorage().deleteProfile(args[0]);
64-
if (!(sender instanceof ConsoleCommandSender)) {
65-
if (count == 0) {
66-
sender.sendMessage("Error: No profile entries found!");
67-
} else {
68-
sender.sendMessage("Deleted " + count + " matching profile entries");
68+
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
69+
int count = plugin.getCore().getStorage().deleteProfile(args[0]);
70+
if (!(sender instanceof ConsoleCommandSender)) {
71+
Bukkit.getScheduler().runTask(plugin, () -> {
72+
if (count == 0) {
73+
sender.sendMessage("Error: No profile entries found!");
74+
} else {
75+
sender.sendMessage("Deleted " + count + " matching profile entries");
76+
}
77+
});
6978
}
70-
}
79+
});
7180

7281
return true;
7382
}

bukkit/src/main/resources/plugin.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,4 @@ permissions:
7070

7171
${project.artifactId}.command.delete:
7272
description: 'Delete other players profile data'
73-
default: true
73+
default: false

0 commit comments

Comments
 (0)