Interface CommandContext

All Known Implementing Classes:
StringContext

public interface CommandContext
The context a command is executed in, responsible for parsing, tab-completing and executing the command. It contains data such as the command target and the arguments provided to it so far.
Since:
2.0.0
  • Method Details

    • getTarget

      PermissionHolder getTarget()
      Gets this command context's target.
    • getArgumentValue

      @Nullable <U> U getArgumentValue(CommandArgument<U> argument)
      Gets the value of an argument.
      Parameters:
      argument - the argument to get the value for
      Returns:
      the value if available - if unset then null
    • getArgumentValue

      @Nullable @Nullable Object getArgumentValue(String name)
      Gets the value of an argument by name.
      Parameters:
      name - the name of the argument to get the value for
      Returns:
      the value if available, if unset then null.
      Throws:
      IllegalArgumentException - if the name given is not a registered argument
    • getRaw

      String getRaw()
      Gets the raw input given to this context.
    • getFormat

      @NotNull @NotNull FormatProvider getFormat()
      Gets the format provider to use in message decoration.
    • tabComplete

      @Nullable @Nullable List<String> tabComplete()
      Gets a list of entries for tab completion.
    • execute

      net.kyori.adventure.text.Component execute()
      Executes the command.
    • getTail

      CommandNode<?> getTail()
      Gets the last node in the chain that has been reached.