Package cloud.commandframework
Class Command<C>
java.lang.Object
cloud.commandframework.Command<C>
- Type Parameters:
C- Command sender type
A command consists out of a chain of
command arguments.-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionCommand(@NonNull List<@NonNull CommandComponent<C>> commandComponents, @NonNull CommandExecutionHandler<@NonNull C> commandExecutionHandler, @NonNull CommandPermission commandPermission, @NonNull CommandMeta commandMeta) Construct a new commandCommand(@NonNull List<@NonNull CommandComponent<C>> commandComponents, @NonNull CommandExecutionHandler<@NonNull C> commandExecutionHandler, @Nullable Class<? extends C> senderType, @NonNull CommandMeta commandMeta) Construct a new commandCommand(@NonNull List<@NonNull CommandComponent<C>> commandComponents, @NonNull CommandExecutionHandler<@NonNull C> commandExecutionHandler, @Nullable Class<? extends C> senderType, @NonNull CommandPermission commandPermission, @NonNull CommandMeta commandMeta) Construct a new commandCommand(@NonNull Map<@NonNull CommandArgument<C, ?>, @NonNull Description> commandArguments, @NonNull CommandExecutionHandler<@NonNull C> commandExecutionHandler, @NonNull CommandPermission commandPermission, @NonNull CommandMeta commandMeta) Deprecated.Map does not allow for the same literal or variable argument name to repeatCommand(@NonNull Map<@NonNull CommandArgument<C, ?>, @NonNull Description> commandArguments, @NonNull CommandExecutionHandler<@NonNull C> commandExecutionHandler, @Nullable Class<? extends C> senderType, @NonNull CommandMeta commandMeta) Deprecated.Map does not allow for the same literal or variable argument name to repeatCommand(@NonNull Map<@NonNull CommandArgument<C, ?>, @NonNull Description> commandArguments, @NonNull CommandExecutionHandler<@NonNull C> commandExecutionHandler, @Nullable Class<? extends C> senderType, @NonNull CommandPermission commandPermission, @NonNull CommandMeta commandMeta) Deprecated.Map does not allow for the same literal or variable argument name to repeat -
Method Summary
Modifier and TypeMethodDescription@NonNull StringgetArgumentDescription(@NonNull CommandArgument<C, ?> argument) Deprecated.More than one matching command argument may exist per command.@NonNull List<CommandArgument<@NonNull C,@NonNull ?>> Return a copy of the command argument arrayCommandExecutionHandler<@NonNull C>Get the command execution handler@NonNull CommandMetaGet the command meta instance@NonNull CommandPermissionGet the command permission@NonNull List<CommandComponent<@NonNull C>>Returns a copy of the command component arrayGet the required sender type, if one has been specifiedbooleanisHidden()Check whether the command is hiddenstatic <C> @NonNull Command.Builder<C>newBuilder(@NonNull String commandName, @NonNull CommandMeta commandMeta, @NonNull ArgumentDescription description, @NonNull String... aliases) Create a new command builder.static <C> @NonNull Command.Builder<C>newBuilder(@NonNull String commandName, @NonNull CommandMeta commandMeta, @NonNull Description description, @NonNull String... aliases) Deprecated.for removal since 1.4.0.static <C> @NonNull Command.Builder<C>newBuilder(@NonNull String commandName, @NonNull CommandMeta commandMeta, @NonNull String... aliases) Create a new command builder.final StringtoString()
-
Constructor Details
-
Command
@API(status=STABLE, since="1.3.0") public Command(@NonNull List<@NonNull CommandComponent<C>> commandComponents, @NonNull CommandExecutionHandler<@NonNull C> commandExecutionHandler, @Nullable Class<? extends C> senderType, @NonNull CommandPermission commandPermission, @NonNull CommandMeta commandMeta) Construct a new command- Parameters:
commandComponents- Command component argument and descriptioncommandExecutionHandler- Execution handlersenderType- Required sender type. May benullcommandPermission- Command permissioncommandMeta- Command meta instance- Since:
- 1.3.0
-
Command
@API(status=STABLE, since="1.3.0") public Command(@NonNull List<@NonNull CommandComponent<C>> commandComponents, @NonNull CommandExecutionHandler<@NonNull C> commandExecutionHandler, @Nullable Class<? extends C> senderType, @NonNull CommandMeta commandMeta) Construct a new command- Parameters:
commandComponents- Command componentscommandExecutionHandler- Execution handlersenderType- Required sender type. May benullcommandMeta- Command meta instance- Since:
- 1.3.0
-
Command
@API(status=STABLE, since="1.3.0") public Command(@NonNull List<@NonNull CommandComponent<C>> commandComponents, @NonNull CommandExecutionHandler<@NonNull C> commandExecutionHandler, @NonNull CommandPermission commandPermission, @NonNull CommandMeta commandMeta) Construct a new command- Parameters:
commandComponents- Command componentscommandExecutionHandler- Execution handlercommandPermission- Command permissioncommandMeta- Command meta instance- Since:
- 1.3.0
-
Command
@Deprecated @API(status=DEPRECATED) public Command(@NonNull Map<@NonNull CommandArgument<C, ?>, @NonNull Description> commandArguments, @NonNull CommandExecutionHandler<@NonNull C> commandExecutionHandler, @Nullable Class<? extends C> senderType, @NonNull CommandPermission commandPermission, @NonNull CommandMeta commandMeta) Deprecated.Map does not allow for the same literal or variable argument name to repeatConstruct a new command- Parameters:
commandArguments- Command argument and description pairscommandExecutionHandler- Execution handlersenderType- Required sender type. May benullcommandPermission- Command permissioncommandMeta- Command meta instance- See Also:
-
Command
@Deprecated @API(status=DEPRECATED) public Command(@NonNull Map<@NonNull CommandArgument<C, ?>, @NonNull Description> commandArguments, @NonNull CommandExecutionHandler<@NonNull C> commandExecutionHandler, @Nullable Class<? extends C> senderType, @NonNull CommandMeta commandMeta) Deprecated.Map does not allow for the same literal or variable argument name to repeatConstruct a new command- Parameters:
commandArguments- Command argumentscommandExecutionHandler- Execution handlersenderType- Required sender type. May benullcommandMeta- Command meta instance- See Also:
-
Command
@Deprecated @API(status=DEPRECATED) public Command(@NonNull Map<@NonNull CommandArgument<C, ?>, @NonNull Description> commandArguments, @NonNull CommandExecutionHandler<@NonNull C> commandExecutionHandler, @NonNull CommandPermission commandPermission, @NonNull CommandMeta commandMeta) Deprecated.Map does not allow for the same literal or variable argument name to repeatConstruct a new command- Parameters:
commandArguments- Command argumentscommandExecutionHandler- Execution handlercommandPermission- Command permissioncommandMeta- Command meta instance- See Also:
-
-
Method Details
-
newBuilder
@Deprecated @API(status=DEPRECATED, since="1.4.0") public static <C> @NonNull Command.Builder<C> newBuilder(@NonNull String commandName, @NonNull CommandMeta commandMeta, @NonNull Description description, @NonNull String... aliases) Deprecated.for removal since 1.4.0. UsenewBuilder(String, CommandMeta, ArgumentDescription, String...)instead.Create a new command builder. Is recommended to use the builder methods inCommandManagerrather than invoking this method directly.- Type Parameters:
C- Command sender type- Parameters:
commandName- Base command argumentcommandMeta- Command meta instancedescription- Command descriptionaliases- Command aliases- Returns:
- Command builder
-
newBuilder
@API(status=STABLE, since="1.4.0") public static <C> @NonNull Command.Builder<C> newBuilder(@NonNull String commandName, @NonNull CommandMeta commandMeta, @NonNull ArgumentDescription description, @NonNull String... aliases) Create a new command builder. Is recommended to use the builder methods inCommandManagerrather than invoking this method directly.- Type Parameters:
C- Command sender type- Parameters:
commandName- Base command argumentcommandMeta- Command meta instancedescription- Command descriptionaliases- Command aliases- Returns:
- Command builder
- Since:
- 1.4.0
-
newBuilder
public static <C> @NonNull Command.Builder<C> newBuilder(@NonNull String commandName, @NonNull CommandMeta commandMeta, @NonNull String... aliases) Create a new command builder. Is recommended to use the builder methods inCommandManagerrather than invoking this method directly.- Type Parameters:
C- Command sender type- Parameters:
commandName- Base command argumentcommandMeta- Command meta instancealiases- Command aliases- Returns:
- Command builder
-
getArguments
Return a copy of the command argument array- Returns:
- Copy of the command argument array. This List is mutable.
-
getComponents
@API(status=STABLE, since="1.3.0") public @NonNull List<CommandComponent<@NonNull C>> getComponents()Returns a copy of the command component array- Returns:
- Copy of the command component array. This List is mutable
- Since:
- 1.3.0
-
getCommandExecutionHandler
Get the command execution handler- Returns:
- Command execution handler
-
getSenderType
Get the required sender type, if one has been specified- Returns:
- Required sender type
-
getCommandPermission
Get the command permission- Returns:
- Command permission
-
getCommandMeta
Get the command meta instance- Returns:
- Command meta
-
getArgumentDescription
@Deprecated @API(status=DEPRECATED) public @NonNull String getArgumentDescription(@NonNull CommandArgument<C, ?> argument) Deprecated.More than one matching command argument may exist per command. UsegetArguments()and search in that, instead.Get the description for an argument- Parameters:
argument- Argument- Returns:
- Argument description
- Throws:
IllegalArgumentException- If the command argument does not exist
-
toString
-
isHidden
public boolean isHidden()Check whether the command is hidden- Returns:
trueif the command is hidden,falseif not
-