Package revxrsal.commands.command
Interface ExecutableCommand
- All Superinterfaces:
CommandAnnotationHolder
,Comparable<ExecutableCommand>
,PermissionHolder
public interface ExecutableCommand
extends CommandAnnotationHolder, PermissionHolder, Comparable<ExecutableCommand>
Represents a command which can be executed with specific arguments,
flags or switches.
-
Method Summary
Modifier and TypeMethodDescription@NotNull CommandHandler
Returns the command handler of this command@Nullable String
Returns the command's description.@org.jetbrains.annotations.Range(from=0L, to=9223372036854775807L) int
getId()
Returns a unique ID of this command.@NotNull String
getName()
Returns the name of the command@NotNull @Unmodifiable List<CommandParameter>
Returns all the parameters of this command@Nullable CommandCategory
Returns the parent category of this command.@NotNull CommandPath
getPath()
Returns the full path of the command<T> @NotNull ResponseHandler<T>
Returns the response handler of this command.@NotNull String
getUsage()
Returns the command usage.@NotNull @Unmodifiable Map<Integer,
CommandParameter> Returns all the parameters of this command that are resolveable from command arguments (i.e.boolean
isSecret()
Returns whether is this command marked as secret or notMethods inherited from interface revxrsal.commands.command.trait.CommandAnnotationHolder
getAnnotation, hasAnnotation
Methods inherited from interface java.lang.Comparable
compareTo
Methods inherited from interface revxrsal.commands.command.trait.PermissionHolder
checkPermission, getPermission, hasPermission
-
Method Details
-
getName
Returns the name of the command- Returns:
- The command name
-
getId
@org.jetbrains.annotations.Range(from=0L, to=9223372036854775807L) int getId()Returns a unique ID of this command. Note that this ID will be shared by commands that are defined together in the same method through aliases.For example:
@Command({"foo", "bar"}) public void foo(CommandActor actor) { actor.reply("Way to go!"); }
The above code will result in 2 separate
ExecutableCommand
s: foo and bar. Because foo and bar are defined in the same scope and behave exactly the same, they will share the same ID. This will also make sure that if an actor is on cooldown on foo, they will also be on cooldown on bar.- Returns:
- The unique ID.
-
getUsage
Returns the command usage. This can be explicitly defined by annotating the method withUsage
, otherwise will be auto-generated by marking required parameters with angled brackets, and optional ones with squared brackets.- Returns:
- The command usage.
-
getDescription
Returns the command's description. This can be explicitly defined withDescription
, otherwise will return null.- Returns:
- The command description
-
getPath
Returns the full path of the command- Returns:
- The full command path
-
getParent
Returns the parent category of this command. Can be null in case of root commands.- Returns:
- The parent category of this command.
-
getParameters
Returns all the parameters of this command- Returns:
- The command parameters
-
getValueParameters
Returns all the parameters of this command that are resolveable from command arguments (i.e. not context)- Returns:
- The command parameters
-
getCommandHandler
Returns the command handler of this command- Returns:
- The command handler
-
getResponseHandler
Returns the response handler of this command.- Type Parameters:
T
- The return type- Returns:
- The command's response handler
-
isSecret
boolean isSecret()Returns whether is this command marked as secret or notSpecified by
SecretCommand
.- Returns:
- is secret or not.
-