Interface Context<S>

All Known Implementing Classes:
CommandContext, DelegateCommandContext

public interface Context<S>
  • Method Summary

    Modifier and Type
    Method
    Description
    @NotNull Command<S>
    The command found and used in the context made by the command sender
    The flags used in the command
    int
    Fetches the number of flags used in the raw arguments
    <T> T
    getArgument(int index)
    Fetches the parsed argument value may return null if the value parsed is not valid some cases of failed argument parsing may be like this one: an integer argument with min of 1 and max of 10, however the input was "one" or may be "-1" which is not a valid value .
    <T> T
    Fetches the parsed argument value may return null if the value parsed is not valid some cases of failed argument parsing may be like this one: an integer argument with min of 1 and max of 10, however the input was "one" or may be "-1" which is not a valid value .
    default int
     
    @Nullable String
    getRawArgument(int index)
    Fetches the raw argument from the input in the constructor
    @NotNull List<String>
    The raw arguments used in the context made by the command sender
    @Nullable Argument<?>
    Fetches the original required argument stated by the syntax executed
    int
    The length of the args used in the raw context
    <T> void
    Parses the arguments into the used syntax this algorithm should provide good reasonable performance
    int
    The number of parsed args
    @NotNull String
    The raw arguments formatted using the command used
    Fetches the sender for this context
    @NotNull CommandSyntax<S>
     
  • Method Details

    • flagsUsed

      int flagsUsed()
      Fetches the number of flags used in the raw arguments
      Returns:
      the count of flags used in raw args
    • sender

      @NotNull S sender()
      Fetches the sender for this context
      Returns:
      the context command sender
    • commandUsed

      @NotNull @NotNull Command<S> commandUsed()
      The command found and used in the context made by the command sender
      Returns:
      the command used !
      See Also:
    • getRawArguments

      @NotNull @NotNull List<String> getRawArguments()
      The raw arguments used in the context made by the command sender
      Returns:
      The raw arguments
    • rawFormat

      @NotNull @NotNull String rawFormat()
      The raw arguments formatted using the command used
      Returns:
      the raw format used in the context
      See Also:
    • getRawArgument

      @Nullable @Nullable String getRawArgument(int index)
      Fetches the raw argument from the input in the constructor
      Parameters:
      index - the index of the raw argument to fetch
      Returns:
      the raw argument at a specific position
    • getArgument

      @Nullable <T> T getArgument(String id)
      Fetches the parsed argument value may return null if the value parsed is not valid some cases of failed argument parsing may be like this one: an integer argument with min of 1 and max of 10, however the input was "one" or may be "-1" which is not a valid value .
      Type Parameters:
      T - the type of arg value
      Parameters:
      id - the argument name/id
      Returns:
      the parsed value of the argument
    • getArgument

      @Nullable <T> T getArgument(int index)
      Fetches the parsed argument value may return null if the value parsed is not valid some cases of failed argument parsing may be like this one: an integer argument with min of 1 and max of 10, however the input was "one" or may be "-1" which is not a valid value .
      Type Parameters:
      T - the type of arg value
      Parameters:
      index - the argument index/position
      Returns:
      the parsed value of the argument
    • getRequiredArgument

      @Nullable @Nullable Argument<?> getRequiredArgument(int index)
      Fetches the original required argument stated by the syntax executed
      Parameters:
      index - the index of the arg
      Returns:
      the original required argument
    • parse

      <T> void parse() throws ArgumentParseException
      Parses the arguments into the used syntax this algorithm should provide good reasonable performance
      Throws:
      ArgumentParseException
    • parsedArguments

      int parsedArguments()
      The number of parsed args
      Returns:
      the number of arguments parsed in the context
    • flags

      @NotNull @NotNull ContextFlagRegistry<S> flags()
      The flags used in the command
      Returns:
      the flag registry for the flags used in the context of the command executed by the command sender
    • syntaxUsed

      @NotNull @NotNull CommandSyntax<S> syntaxUsed()
      Returns:
      The syntax used in the context of the command
    • length

      int length()
      The length of the args used in the raw context
      Returns:
      The length of the args used in the raw context
    • getLastIndex

      default int getLastIndex()