Search in sources :

Example 6 with StringPlaceholders

use of dev.rosewood.rosegarden.utils.StringPlaceholders 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

StringPlaceholders (dev.rosewood.rosegarden.utils.StringPlaceholders)6 LocaleManager (dev.rosewood.rosestacker.manager.LocaleManager)3 StackSettingManager (dev.rosewood.rosestacker.manager.StackSettingManager)3 NMSHandler (dev.rosewood.rosestacker.nms.NMSHandler)3 ItemStack (org.bukkit.inventory.ItemStack)3 ItemMeta (org.bukkit.inventory.meta.ItemMeta)3 RosePlugin (dev.rosewood.rosegarden.RosePlugin)1 ArgumentParser (dev.rosewood.rosegarden.command.framework.ArgumentParser)1 RoseCommand (dev.rosewood.rosegarden.command.framework.RoseCommand)1 RoseCommandArgumentHandler (dev.rosewood.rosegarden.command.framework.RoseCommandArgumentHandler)1 RoseCommandArgumentInfo (dev.rosewood.rosegarden.command.framework.RoseCommandArgumentInfo)1 RoseExecutable (dev.rosewood.rosegarden.command.framework.annotation.RoseExecutable)1 AbstractLocaleManager (dev.rosewood.rosegarden.manager.AbstractLocaleManager)1 BlockStackSettings (dev.rosewood.rosestacker.stack.settings.BlockStackSettings)1 EntityStackSettings (dev.rosewood.rosestacker.stack.settings.EntityStackSettings)1 SpawnerStackSettings (dev.rosewood.rosestacker.stack.settings.SpawnerStackSettings)1 List (java.util.List)1 Optional (java.util.Optional)1 Collectors (java.util.stream.Collectors)1 Stream (java.util.stream.Stream)1