Class StringArgument<S extends CommandSource>

All Implemented Interfaces:
Prioritizable

public final class StringArgument<S extends CommandSource> extends ArgumentType<S,String>
  • Method Details

    • parse

      public String parse(@NotNull @NotNull CommandContext<S> context, @NotNull @NotNull Argument<S> argument, @NotNull @NotNull String input) throws CommandException
      Description copied from class: ArgumentType
      Parses the argument value from the given input string, using the provided execution context. This method is responsible for converting the raw input into the appropriate type, handling any necessary validation or error handling during the parsing process.
      Specified by:
      parse in class ArgumentType<S extends CommandSource,String>
      Parameters:
      context - the execution context.
      argument - the argument with this type.
      input - the raw input string to parse.
      Returns:
      the resolved value of type T.
      Throws:
      CommandException - if parsing fails.
    • isGreedy

      public boolean isGreedy(Argument<S> parameter)
      Description copied from class: ArgumentType
      Determines if this parameter type is greedy, meaning it consumes multiple arguments. By default, returns false.
      Overrides:
      isGreedy in class ArgumentType<S extends CommandSource,String>
      Parameters:
      parameter - the command parameter.
      Returns:
      true if greedy, false otherwise.
    • getNumberOfParametersToConsume

      public int getNumberOfParametersToConsume(Argument<S> argument)
      Description copied from class: ArgumentType
      Returns the number of arguments consumed by this parameter type. By default, returns 1.
      Overrides:
      getNumberOfParametersToConsume in class ArgumentType<S extends CommandSource,String>
      Returns:
      the number of consumed arguments.
    • getPriority

      @NotNull public @NotNull Priority getPriority()
      Specified by:
      getPriority in interface Prioritizable
      Overrides:
      getPriority in class ArgumentType<S extends CommandSource,String>