A - The actor typepublic interface ExecutableCommand<A extends CommandActor> extends java.lang.Comparable<ExecutableCommand<A>>, java.lang.Iterable<CommandNode<A>>, RequiresPermission<A>, HasDescription
test(CommandActor, MutableStringStream)| Modifier and Type | Method and Description |
|---|---|
default @NotNull CommandAction<A> |
action()
Returns the action of this command.
|
default @NotNull AnnotationList |
annotations()
Returns the annotations on the function
|
default Help.ChildrenCommands<A> |
childrenCommands()
Returns all children commands of this command.
|
Help.ChildrenCommands<A> |
childrenCommands(A filterFor)
Returns all children commands of this command.
|
@NotNull java.util.OptionalInt |
commandPriority()
Returns the explicit priority defined by
CommandPriority. |
boolean |
containsFlags()
|
@Nullable java.lang.String |
description()
Returns the description of this command.
|
default void |
execute(A actor,
@NotNull MutableStringStream input)
Executes this command with the given actor and input.
|
void |
execute(@NotNull ExecutionContext<A> context)
Executes this command with the given context.
|
@NotNull LiteralNode<A> |
firstNode()
Returns the first node in this command.
|
@NotNull CommandFunction |
function()
Returns the underlying
CommandFunction of this
command |
boolean |
isChildOf(@NotNull ExecutableCommand<A> command)
Tests whether this command is a child of the provided command.
|
default boolean |
isParentOf(@NotNull ExecutableCommand<A> command)
Tests whether the provided command is a child of this command.
|
default boolean |
isRelatedTo(@NotNull ExecutableCommand<A> command)
Tests whether is the provided command related to this command
or not.
|
boolean |
isSecret()
Tests whether this command is secret or not.
|
boolean |
isSiblingOf(@NotNull ExecutableCommand<A> command)
Tests whether are these two commands siblings.
|
default boolean |
isVisibleTo(A actor)
Tests whether this command is visible to the actor or not.
|
@NotNull Lamp<A> |
lamp()
Returns the
Lamp instance that created this command |
@NotNull CommandNode<A> |
lastNode()
Returns the very last node in this command.
|
@NotNull @Unmodifiable java.util.List<CommandNode<A>> |
nodes()
Returns an immutable
List containing all the nodes
in this command. |
int |
optionalParameters()
Returns the number of optional parameters in this command
|
default <T> @NotNull ParameterNode<A,T> |
parameter(@NotNull java.lang.String name)
Returns the parameter with the given name, or throws
IllegalArgumentException if
it does not exist. |
default <T> @Nullable ParameterNode<A,T> |
parameterOrNull(@NotNull java.lang.String name)
Returns the parameter with the given name, or
null if
it does not exist. |
@NotNull @Unmodifiable java.util.Map<java.lang.String,ParameterNode<A,java.lang.Object>> |
parameters()
Returns all the parameters in this command, in the same order
they are declared in the command.
|
@NotNull java.lang.String |
path()
Returns the path of this command.
|
default @NotNull Help.RelatedCommands<A> |
relatedCommands()
Returns all related commands of this command.
|
@NotNull Help.RelatedCommands<A> |
relatedCommands(A filterFor)
Returns all related commands of this command.
|
int |
requiredInput()
Returns the number of required literals or parameters in this command
|
default Help.SiblingCommands<A> |
siblingCommands()
Returns all siblings of this command
|
Help.SiblingCommands<A> |
siblingCommands(A filterFor)
Returns all siblings of this command
|
@Range(from=1L,to=2147483647L) int |
size()
Returns the amount of nodes in this command.
|
@NotNull Potential<A> |
test(A actor,
@NotNull MutableStringStream input)
Tests this command with the given input, returning a
Potential
which contains the parameters parsed as well as any other errors
that occurred during execution. |
void |
unregister()
Unregisters this executable command.
|
@NotNull java.lang.String |
usage()
Returns the usage of this command.
|
permission@NotNull @NotNull Lamp<A> lamp()
Lamp instance that created this command@Range(from=1L,to=2147483647L) int size()
int optionalParameters()
int requiredInput()
@NotNull @NotNull java.lang.String path()
@NotNull @NotNull java.lang.String usage()
@Usage. Otherwise, it will be auto-generated@Nullable @Nullable java.lang.String description()
@Description.description in interface HasDescription@NotNull @NotNull CommandFunction function()
CommandFunction of this
command@NotNull @NotNull CommandNode<A> lastNode()
@NotNull @NotNull LiteralNode<A> firstNode()
LiteralNode@NotNull @CheckReturnValue @NotNull Potential<A> test(@NotNull A actor, @NotNull @NotNull MutableStringStream input)
Potential
which contains the parameters parsed as well as any other errors
that occurred during execution.actor - The actor executing the commandinput - The inputPotential result@NotNull @NotNull @Unmodifiable java.util.List<CommandNode<A>> nodes()
List containing all the nodes
in this command.@NotNull @NotNull java.util.OptionalInt commandPriority()
CommandPriority.boolean isSecret()
@SecretCommand.void unregister()
default void execute(@NotNull
A actor,
@NotNull
@NotNull MutableStringStream input)
actor - Actor to execute the command asinput - The input to execute withvoid execute(@NotNull
@NotNull ExecutionContext<A> context)
Note that this will check all CommandCondition registered
in the lamp() instance.
context - The context to execute with@NotNull default @NotNull CommandAction<A> action()
@NotNull default @NotNull AnnotationList annotations()
@NotNull @NotNull Help.RelatedCommands<A> relatedCommands(@Nullable A filterFor)
filterFor - Actor to filter entries for, by checking permissions@NotNull default @NotNull Help.RelatedCommands<A> relatedCommands()
@NotNull Help.ChildrenCommands<A> childrenCommands(@Nullable A filterFor)
filterFor - Actor to filter entries for, by checking permissions@NotNull default Help.ChildrenCommands<A> childrenCommands()
@NotNull Help.SiblingCommands<A> siblingCommands(@Nullable A filterFor)
filterFor - Actor to filter entries for, by checking permissions@NotNull default Help.SiblingCommands<A> siblingCommands()
@NotNull @Contract(pure=true) @NotNull @Unmodifiable java.util.Map<java.lang.String,ParameterNode<A,java.lang.Object>> parameters()
@Nullable default <T> @Nullable ParameterNode<A,T> parameterOrNull(@NotNull @NotNull java.lang.String name)
null if
it does not exist.T - The parameter type, automatically cast.name - The parameter namenull if not present.@NotNull default <T> @NotNull ParameterNode<A,T> parameter(@NotNull @NotNull java.lang.String name)
IllegalArgumentException if
it does not exist.T - The parameter type, automatically cast.name - The parameter namejava.lang.IllegalArgumentException - if it does not existboolean isSiblingOf(@NotNull
@NotNull ExecutableCommand<A> command)
command - Command to compare withboolean isChildOf(@NotNull
@NotNull ExecutableCommand<A> command)
command - Command to compare withdefault boolean isParentOf(@NotNull
@NotNull ExecutableCommand<A> command)
command - Command to compare withdefault boolean isRelatedTo(@NotNull
@NotNull ExecutableCommand<A> command)
command - Command to testdefault boolean isVisibleTo(@NotNull
A actor)
This involves checking if the command for:
SecretCommand): As these cannot be seen by any commandactor - Actor to show the message to