Class StringArrayArgument.StringArrayParser<C>

  • Type Parameters:
    C - Command sender type
    All Implemented Interfaces:
    ArgumentParser<C,​java.lang.String[]>
    Enclosing class:
    StringArrayArgument<C>

    public static final class StringArrayArgument.StringArrayParser<C>
    extends java.lang.Object
    implements ArgumentParser<C,​java.lang.String[]>
    Parser that parses input into a string array
    • Constructor Detail

      • StringArrayParser

        public StringArrayParser()
    • Method Detail

      • parse

        public @NonNull ArgumentParseResult<java.lang.String @NonNull []> parse​(@NonNull CommandContext<@NonNull C> commandContext,
                                                                                @NonNull java.util.Queue<@NonNull java.lang.String> inputQueue)
        Description copied from interface: ArgumentParser
        Parse command input into a command result.

        This method may be called when a command chain is being parsed for execution (using CommandManager.executeCommand(Object, String)) or when a command is being parsed to provide context for suggestions (using CommandManager.suggest(Object, String)). It is possible to use CommandContext.isSuggestions()} to see what the purpose of the parsing is. Particular care should be taken when parsing for suggestions, as the parsing method is then likely to be called once for every character written by the command sender.

        This method should never throw any exceptions under normal circumstances. Instead, if the parsing for some reason cannot be done successfully ArgumentParseResult.failure(Throwable) should be returned. This then wraps any exception that should be forwarded to the command sender.

        The parser is assumed to be completely stateless and should not store any information about the command sender or the command context. Instead, information should be stored in the CommandContext.

        Specified by:
        parse in interface ArgumentParser<C,​java.lang.String[]>
        Parameters:
        commandContext - Command context
        inputQueue - The queue of arguments
        Returns:
        Parsed command result