mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2025-01-19 14:51:21 +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 =
|
LiteralCommandNode<S> cancelRenderCommand =
|
||||||
literal("cancel")
|
literal("cancel")
|
||||||
.requires(requirements("bluemap.render"))
|
.requires(requirements("bluemap.render"))
|
||||||
|
.executes(this::cancelLastRenderTaskCommand)
|
||||||
|
|
||||||
.then(argument("uuid", StringArgumentType.string())
|
.then(argument("uuid", StringArgumentType.string())
|
||||||
.executes(this::cancelRenderTaskCommand))
|
.executes(this::cancelRenderTaskCommand))
|
||||||
|
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
LiteralCommandNode<S> worldsCommand =
|
LiteralCommandNode<S> worldsCommand =
|
||||||
@ -570,6 +573,22 @@ public int prioritizeRenderTaskCommand(CommandContext<S> context) {
|
|||||||
return 0;
|
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) {
|
public int cancelRenderTaskCommand(CommandContext<S> context) {
|
||||||
CommandSource source = commandSourceInterface.apply(context.getSource());
|
CommandSource source = commandSourceInterface.apply(context.getSource());
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user