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 Summary
Modifier and TypeMethodDescriptionnet.kyori.adventure.text.Componentexecute()Executes the command.@Nullable ObjectgetArgumentValue(String name)Gets the value of an argument by name.<U> UgetArgumentValue(CommandArgument<U> argument)Gets the value of an argument.@NotNull FormatProviderGets the format provider to use in message decoration.getRaw()Gets the raw input given to this context.CommandNode<?>getTail()Gets the last node in the chain that has been reached.Gets this command context's target.Gets a list of entries for tab completion.
-
Method Details
-
getTarget
PermissionHolder getTarget()Gets this command context's target. -
getArgumentValue
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
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
Gets the format provider to use in message decoration. -
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.
-