Package cloud.commandframework
Class Command<C>
- java.lang.Object
-
- cloud.commandframework.Command<C>
-
- Type Parameters:
C
- Command sender type
public class Command<C> extends java.lang.Object
A command consists out of a chain ofcommand arguments
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Command.Builder<C>
Builder forCommand
instances.
-
Constructor Summary
Constructors Constructor Description Command(@NonNull java.util.Map<@NonNull CommandArgument<C,?>,@NonNull Description> commandArguments, @NonNull CommandExecutionHandler<@NonNull C> commandExecutionHandler, @NonNull CommandPermission commandPermission, @NonNull CommandMeta commandMeta)
Construct a new commandCommand(@NonNull java.util.Map<@NonNull CommandArgument<C,?>,@NonNull Description> commandArguments, @NonNull CommandExecutionHandler<@NonNull C> commandExecutionHandler, @Nullable java.lang.Class<? extends C> senderType, @NonNull CommandMeta commandMeta)
Construct a new commandCommand(@NonNull java.util.Map<@NonNull CommandArgument<C,?>,@NonNull Description> commandArguments, @NonNull CommandExecutionHandler<@NonNull C> commandExecutionHandler, @Nullable java.lang.Class<? extends C> senderType, @NonNull CommandPermission commandPermission, @NonNull CommandMeta commandMeta)
Construct a new command
-
Method Summary
Modifier and Type Method Description @NonNull java.lang.String
getArgumentDescription(@NonNull CommandArgument<C,?> argument)
Get the description for an argument@NonNull java.util.List<CommandArgument<@NonNull C,?>>
getArguments()
Return a copy of the command argument arrayCommandExecutionHandler<@NonNull C>
getCommandExecutionHandler()
Get the command execution handler@NonNull CommandMeta
getCommandMeta()
Get the command meta instance@NonNull CommandPermission
getCommandPermission()
Get the command permission@NonNull java.util.Optional<java.lang.Class<? extends C>>
getSenderType()
Get the required sender type, if one has been specifiedboolean
isHidden()
Check whether or not the command is hiddenstatic <C> @NonNull Command.Builder<C>
newBuilder(@NonNull java.lang.String commandName, @NonNull CommandMeta commandMeta, @NonNull Description description, @NonNull java.lang.String... aliases)
Create a new command builder.static <C> @NonNull Command.Builder<C>
newBuilder(@NonNull java.lang.String commandName, @NonNull CommandMeta commandMeta, @NonNull java.lang.String... aliases)
Create a new command builder.java.lang.String
toString()
-
-
-
Constructor Detail
-
Command
public Command(@NonNull java.util.Map<@NonNull CommandArgument<C,?>,@NonNull Description> commandArguments, @NonNull CommandExecutionHandler<@NonNull C> commandExecutionHandler, @Nullable java.lang.Class<? extends C> senderType, @NonNull CommandPermission commandPermission, @NonNull CommandMeta commandMeta)
Construct a new command- Parameters:
commandArguments
- Command argument and description pairscommandExecutionHandler
- Execution handlersenderType
- Required sender type. May benull
commandPermission
- Command permissioncommandMeta
- Command meta instance
-
Command
public Command(@NonNull java.util.Map<@NonNull CommandArgument<C,?>,@NonNull Description> commandArguments, @NonNull CommandExecutionHandler<@NonNull C> commandExecutionHandler, @Nullable java.lang.Class<? extends C> senderType, @NonNull CommandMeta commandMeta)
Construct a new command- Parameters:
commandArguments
- Command argumentscommandExecutionHandler
- Execution handlersenderType
- Required sender type. May benull
commandMeta
- Command meta instance
-
Command
public Command(@NonNull java.util.Map<@NonNull CommandArgument<C,?>,@NonNull Description> commandArguments, @NonNull CommandExecutionHandler<@NonNull C> commandExecutionHandler, @NonNull CommandPermission commandPermission, @NonNull CommandMeta commandMeta)
Construct a new command- Parameters:
commandArguments
- Command argumentscommandExecutionHandler
- Execution handlercommandPermission
- Command permissioncommandMeta
- Command meta instance
-
-
Method Detail
-
newBuilder
public static <C> @NonNull Command.Builder<C> newBuilder(@NonNull java.lang.String commandName, @NonNull CommandMeta commandMeta, @NonNull Description description, @NonNull java.lang.String... aliases)
Create a new command builder. Is recommended to use the builder methods inCommandManager
rather 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
public static <C> @NonNull Command.Builder<C> newBuilder(@NonNull java.lang.String commandName, @NonNull CommandMeta commandMeta, @NonNull java.lang.String... aliases)
Create a new command builder. Is recommended to use the builder methods inCommandManager
rather 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
public @NonNull java.util.List<CommandArgument<@NonNull C,?>> getArguments()
Return a copy of the command argument array- Returns:
- Copy of the command argument array
-
getCommandExecutionHandler
public CommandExecutionHandler<@NonNull C> getCommandExecutionHandler()
Get the command execution handler- Returns:
- Command execution handler
-
getSenderType
public @NonNull java.util.Optional<java.lang.Class<? extends C>> getSenderType()
Get the required sender type, if one has been specified- Returns:
- Required sender type
-
getCommandPermission
public @NonNull CommandPermission getCommandPermission()
Get the command permission- Returns:
- Command permission
-
getCommandMeta
public @NonNull CommandMeta getCommandMeta()
Get the command meta instance- Returns:
- Command meta
-
getArgumentDescription
public @NonNull java.lang.String getArgumentDescription(@NonNull CommandArgument<C,?> argument)
Get the description for an argument- Parameters:
argument
- Argument- Returns:
- Argument description
-
toString
public final java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
isHidden
public boolean isHidden()
Check whether or not the command is hidden- Returns:
true
if the command is hidden,false
if not
-
-