mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2025-01-14 12:11:46 +01:00
Make the uuid argument for the /bluemap render cancel command optional
So it can be used on the console to cancel render-tasks
This commit is contained in:
parent
2d14e83787
commit
3b6ed4c297
@ -176,8 +176,11 @@ public void init() {
|
||||
LiteralCommandNode<S> cancelRenderCommand =
|
||||
literal("cancel")
|
||||
.requires(requirements("bluemap.render"))
|
||||
.executes(this::cancelLastRenderTaskCommand)
|
||||
|
||||
.then(argument("uuid", StringArgumentType.string())
|
||||
.executes(this::cancelRenderTaskCommand))
|
||||
|
||||
.build();
|
||||
|
||||
LiteralCommandNode<S> worldsCommand =
|
||||
@ -570,6 +573,22 @@ public int prioritizeRenderTaskCommand(CommandContext<S> context) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int cancelLastRenderTaskCommand(CommandContext<S> context) {
|
||||
CommandSource source = commandSourceInterface.apply(context.getSource());
|
||||
|
||||
RenderTask[] tasks = plugin.getRenderManager().getRenderTasks();
|
||||
if (tasks.length == 0) {
|
||||
source.sendMessage(Text.of(TextColor.RED, "There is currently no render task scheduled!"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
RenderTask task = tasks[tasks.length - 1];
|
||||
|
||||
plugin.getRenderManager().removeRenderTask(task);
|
||||
source.sendMessage(Text.of(TextColor.GREEN, "The render-task '" + task.getName() + "' has been canceled!"));
|
||||
return 1;
|
||||
}
|
||||
|
||||
public int cancelRenderTaskCommand(CommandContext<S> context) {
|
||||
CommandSource source = commandSourceInterface.apply(context.getSource());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user