Search in sources :

Example 1 with RoseCommand

use of dev.rosewood.rosegarden.command.framework.RoseCommand in project RoseGarden by Rosewood-Development.

the class HelpCommand method execute.

@RoseExecutable
public void execute(CommandContext context) {
    AbstractLocaleManager localeManager = this.rosePlugin.getManager(AbstractLocaleManager.class);
    localeManager.sendCommandMessage(context.getSender(), "command-help-title");
    for (RoseCommand command : this.parent.getCommands()) {
        if (!command.hasHelp() || !command.canUse(context.getSender()))
            continue;
        StringPlaceholders stringPlaceholders = StringPlaceholders.builder("cmd", this.parent.getName()).addPlaceholder("subcmd", command.getName().toLowerCase()).addPlaceholder("args", command.getArgumentsString()).addPlaceholder("desc", localeManager.getLocaleMessage(command.getDescriptionKey())).build();
        localeManager.sendSimpleCommandMessage(context.getSender(), "command-help-list-description" + (command.getNumParameters() == 0 ? "-no-args" : ""), stringPlaceholders);
    }
}
Also used : RoseCommand(dev.rosewood.rosegarden.command.framework.RoseCommand) StringPlaceholders(dev.rosewood.rosegarden.utils.StringPlaceholders) AbstractLocaleManager(dev.rosewood.rosegarden.manager.AbstractLocaleManager) RoseExecutable(dev.rosewood.rosegarden.command.framework.annotation.RoseExecutable)

Aggregations

RoseCommand (dev.rosewood.rosegarden.command.framework.RoseCommand)1 RoseExecutable (dev.rosewood.rosegarden.command.framework.annotation.RoseExecutable)1 AbstractLocaleManager (dev.rosewood.rosegarden.manager.AbstractLocaleManager)1 StringPlaceholders (dev.rosewood.rosegarden.utils.StringPlaceholders)1