Search in sources :

Example 1 with MessageBox

use of com.sk89q.worldedit.util.formatting.component.MessageBox in project WorldGuard by EngineHub.

the class RegionPrintoutBuilder method call.

@Override
public TextComponent call() {
    MessageBox box = new MessageBox("Region Info", builder);
    appendRegionInformation();
    return box.create();
}
Also used : MessageBox(com.sk89q.worldedit.util.formatting.component.MessageBox)

Example 2 with MessageBox

use of com.sk89q.worldedit.util.formatting.component.MessageBox in project WorldGuard by EngineHub.

the class WorldGuardCommands method listRunningTasks.

@Command(aliases = { "running", "queue" }, desc = "List running tasks", max = 0)
@CommandPermissions("worldguard.running")
public void listRunningTasks(CommandContext args, Actor sender) throws CommandException {
    List<Task<?>> tasks = WorldGuard.getInstance().getSupervisor().getTasks();
    if (tasks.isEmpty()) {
        sender.print("There are currently no running tasks.");
    } else {
        tasks.sort(new TaskStateComparator());
        MessageBox builder = new MessageBox("Running Tasks", new TextComponentProducer());
        builder.append(TextComponent.of("Note: Some 'running' tasks may be waiting to be start.", TextColor.GRAY));
        for (Task<?> task : tasks) {
            builder.append(TextComponent.newline());
            builder.append(TextComponent.of("(" + task.getState().name() + ") ", TextColor.BLUE));
            builder.append(TextComponent.of(CommandUtils.getOwnerName(task.getOwner()) + ": ", TextColor.YELLOW));
            builder.append(TextComponent.of(task.getName(), TextColor.WHITE));
        }
        sender.print(builder.create());
    }
}
Also used : FutureForwardingTask(com.sk89q.worldedit.util.task.FutureForwardingTask) Task(com.sk89q.worldedit.util.task.Task) TaskStateComparator(com.sk89q.worldedit.util.task.TaskStateComparator) TextComponentProducer(com.sk89q.worldedit.util.formatting.component.TextComponentProducer) MessageBox(com.sk89q.worldedit.util.formatting.component.MessageBox) NestedCommand(com.sk89q.minecraft.util.commands.NestedCommand) Command(com.sk89q.minecraft.util.commands.Command) CommandPermissions(com.sk89q.minecraft.util.commands.CommandPermissions)

Aggregations

MessageBox (com.sk89q.worldedit.util.formatting.component.MessageBox)2 Command (com.sk89q.minecraft.util.commands.Command)1 CommandPermissions (com.sk89q.minecraft.util.commands.CommandPermissions)1 NestedCommand (com.sk89q.minecraft.util.commands.NestedCommand)1 TextComponentProducer (com.sk89q.worldedit.util.formatting.component.TextComponentProducer)1 FutureForwardingTask (com.sk89q.worldedit.util.task.FutureForwardingTask)1 Task (com.sk89q.worldedit.util.task.Task)1 TaskStateComparator (com.sk89q.worldedit.util.task.TaskStateComparator)1