Search in sources :

Example 1 with RoseExecutable

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

the class BaseCommand method execute.

@RoseExecutable
public void execute(CommandContext context) {
    AbstractLocaleManager localeManager = this.rosePlugin.getManager(AbstractLocaleManager.class);
    String baseColor = localeManager.getLocaleMessage("base-command-color");
    localeManager.sendCustomMessage(context.getSender(), baseColor + "Running <g:#8A2387:#E94057:#F27121>" + this.rosePlugin.getDescription().getName() + baseColor + " v" + this.rosePlugin.getDescription().getVersion());
    localeManager.sendCustomMessage(context.getSender(), baseColor + "Plugin created by: <g:#41E0F0:#FF8DCE>" + this.rosePlugin.getDescription().getAuthors().get(0));
    localeManager.sendSimpleMessage(context.getSender(), "base-command-help", StringPlaceholders.single("cmd", this.parent.getName()));
}
Also used : AbstractLocaleManager(dev.rosewood.rosegarden.manager.AbstractLocaleManager) RoseExecutable(dev.rosewood.rosegarden.command.framework.annotation.RoseExecutable)

Example 2 with RoseExecutable

use of dev.rosewood.rosegarden.command.framework.annotation.RoseExecutable 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

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