Interface CommandContext<T extends me.lucyy.squirtgun.platform.audience.PermissionHolder>
-
- Type Parameters:
T- the subject type.
- All Known Implementing Classes:
StringContext
public interface CommandContext<T extends me.lucyy.squirtgun.platform.audience.PermissionHolder>The context a command is executed in, responsible for parsin, 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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description net.kyori.adventure.text.Componentexecute()Executes the command.@Nullable java.lang.ObjectgetArgumentValue(java.lang.String name)Gets the value of an argument by name.<U> UgetArgumentValue(CommandArgument<U> argument)Gets the value of an argument.@NotNull me.lucyy.squirtgun.format.FormatProvidergetFormat()Gets the format provider to use in message decoration.java.lang.StringgetRaw()Gets the raw input given to this context.CommandNode<T>getTail()Gets the last node in the chain that has been reached.TgetTarget()Gets this command context's target.@Nullable java.util.List<java.lang.String>tabComplete()Gets the string to be shown in the tabcompleter.
-
-
-
Method Detail
-
getTarget
T 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 java.lang.Object getArgumentValue(java.lang.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:
java.lang.IllegalArgumentException- if the name given is not a registered argument
-
getRaw
java.lang.String getRaw()
Gets the raw input given to this context.
-
getFormat
@NotNull @NotNull me.lucyy.squirtgun.format.FormatProvider getFormat()
Gets the format provider to use in message decoration.
-
tabComplete
@Nullable @Nullable java.util.List<java.lang.String> tabComplete()
Gets the string to be shown in the tabcompleter.
-
execute
net.kyori.adventure.text.Component execute()
Executes the command.
-
getTail
CommandNode<T> getTail()
Gets the last node in the chain that has been reached.
-
-