mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-11-27 21:15:57 +01:00
Remove /wg cancelall because it doesn't entirely work yet.
This commit is contained in:
parent
9a852f4cbe
commit
504fceceeb
@ -62,7 +62,7 @@ public void reload(CommandContext args, CommandSender sender) throws CommandExce
|
|||||||
// TODO: This is subject to a race condition, but at least other commands are not being processed concurrently
|
// TODO: This is subject to a race condition, but at least other commands are not being processed concurrently
|
||||||
List<Task<?>> tasks = plugin.getSupervisor().getTasks();
|
List<Task<?>> tasks = plugin.getSupervisor().getTasks();
|
||||||
if (!tasks.isEmpty()) {
|
if (!tasks.isEmpty()) {
|
||||||
throw new CommandException("There are currently pending tasks. Use /wg running and /wg cancelall to monitor and cancel these tasks first.");
|
throw new CommandException("There are currently pending tasks. Use /wg running to monitor these tasks first.");
|
||||||
}
|
}
|
||||||
|
|
||||||
LoggerToChatHandler handler = null;
|
LoggerToChatHandler handler = null;
|
||||||
@ -143,26 +143,6 @@ public void flushStates(CommandContext args, CommandSender sender) throws Comman
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Command(aliases = {"cancelall"}, flags = "f", desc = "Cancel all running tasks", max = 0)
|
|
||||||
@CommandPermissions("worldguard.cancel.all")
|
|
||||||
public void cancelAllTasks(CommandContext args, CommandSender sender) throws CommandException {
|
|
||||||
List<Task<?>> tasks = plugin.getSupervisor().getTasks();
|
|
||||||
|
|
||||||
boolean force = args.hasFlag('f');
|
|
||||||
if (force && !plugin.hasPermission(sender, "worldguard.cancel.force")) {
|
|
||||||
throw new CommandException("You are not permitted to force cancel.");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!tasks.isEmpty()) {
|
|
||||||
for (Task<?> task : tasks) {
|
|
||||||
task.cancel(force);
|
|
||||||
sender.sendMessage(ChatColor.YELLOW + "Cancelled: " + ChatColor.WHITE + task.getName());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
sender.sendMessage(ChatColor.YELLOW + "There are currently no running tasks.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Command(aliases = {"running", "queue"}, desc = "List running tasks", max = 0)
|
@Command(aliases = {"running", "queue"}, desc = "List running tasks", max = 0)
|
||||||
@CommandPermissions("worldguard.running")
|
@CommandPermissions("worldguard.running")
|
||||||
public void listRunningTasks(CommandContext args, CommandSender sender) throws CommandException {
|
public void listRunningTasks(CommandContext args, CommandSender sender) throws CommandException {
|
||||||
|
Loading…
Reference in New Issue
Block a user