Interface ModuleCommandController


public interface ModuleCommandController
Registers module commands with the command framework and keeps track of their argument names, which are translatable and therefore differ per language.
  • Method Details

    • registerCommand

      void registerCommand(ModuleCommand command, UnaryOperator<org.incendo.cloud.Command.Builder<FPlayer>> builder)
      Registers a command under every alias in its config.
      Parameters:
      command - the module that handles it
      builder - describes the arguments
    • registerSubCommand

      void registerSubCommand(ModuleCommand command, String subName, UnaryOperator<org.incendo.cloud.Command.Builder<FPlayer>> builder)
      Registers an extra literal form of an already registered command.
      Parameters:
      command - the module that handles it
      subName - the literal that follows the command name
      builder - describes the remaining arguments
    • clearPrompts

      void clearPrompts(ModuleCommand abstractModuleCommand)
      Forgets a command's argument names, so they are rebuilt after a language change.
      Parameters:
      abstractModuleCommand - the command to clear
    • addPrompt

      String addPrompt(ModuleCommand command, int index, Function<Localization.Command.Prompt, String> promptLocalization)
      Registers the translated name of one argument and returns it.
      Parameters:
      command - the command the argument belongs to
      index - the argument position
      promptLocalization - picks the name out of the localization file
      Returns:
      the registered name
    • getPrompt

      String getPrompt(ModuleCommand command, int index)
      The registered name of one argument.
      Parameters:
      command - the command the argument belongs to
      index - the argument position
      Returns:
      the argument name
    • getPrompts

      List<String> getPrompts(ModuleCommand command)
      Every registered argument name for a command, in order.
      Parameters:
      command - the command
      Returns:
      the argument names
    • getArgument

      <V extends @NonNull Object> V getArgument(ModuleCommand command, org.incendo.cloud.context.CommandContext<FPlayer> context, int promptIndex)
      Reads a parsed argument by position rather than by its translated name.
      Type Parameters:
      V - the argument type
      Parameters:
      command - the command the argument belongs to
      context - the parsed arguments
      promptIndex - the argument position
      Returns:
      the parsed value
    • getCommandName

      String getCommandName(ModuleCommand command)
      The primary alias a command is registered under.
      Parameters:
      command - the command
      Returns:
      the command name