Package com.mrivanplays.jdcf
Class RegisteredCommand
- java.lang.Object
-
- com.mrivanplays.jdcf.RegisteredCommand
-
public final class RegisteredCommand extends java.lang.Object
Represents a registered command. A registered command is a command that was registered into a command manager. In order to have easy access to all the data for the command, this class takes in place, storing all the things possible for a command.
-
-
Constructor Summary
Constructors Constructor Description RegisteredCommand(Command command, java.lang.String usage, java.lang.String description, java.lang.String[] aliases, boolean guildOnly)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
execute(CommandExecutionContext context, CommandArguments args)
Executes the command with the specified context and arguments.@NotNull java.lang.String[]
getAliases()
Returns the aliases (names) of the command (if specified)@NotNull CommandData
getDataAsCommandData()
Returns the data of the command, stored in this object, as a newCommandData
object.@Nullable java.lang.String
getDescription()
Returns the description of the command (if specified)@NotNull java.lang.String
getName()
Returns the "potential" name of the command.@Nullable java.lang.String
getUsage()
Returns the usage of the command (if specified)boolean
hasPermission(@NotNull PermissionCheckContext context)
Checks if the specified member has the required permission to execute this command.boolean
isGuildOnly()
Returns whenever this command should be only executed in guild.
-
-
-
Constructor Detail
-
RegisteredCommand
public RegisteredCommand(Command command, java.lang.String usage, java.lang.String description, java.lang.String[] aliases, boolean guildOnly)
-
-
Method Detail
-
getName
@NotNull public @NotNull java.lang.String getName()
Returns the "potential" name of the command.- Returns:
- first alias specified
-
getUsage
@Nullable public @Nullable java.lang.String getUsage()
Returns the usage of the command (if specified)- Returns:
- usage
-
getDescription
@Nullable public @Nullable java.lang.String getDescription()
Returns the description of the command (if specified)- Returns:
- description
-
getAliases
@NotNull public @NotNull java.lang.String[] getAliases()
Returns the aliases (names) of the command (if specified)- Returns:
- aliases
-
getDataAsCommandData
@NotNull public @NotNull CommandData getDataAsCommandData()
Returns the data of the command, stored in this object, as a newCommandData
object.- Returns:
- command data
-
hasPermission
public boolean hasPermission(@NotNull @NotNull PermissionCheckContext context)
Checks if the specified member has the required permission to execute this command.- Parameters:
context
- permission check context- Returns:
true
if has permission,false
otherwise
-
isGuildOnly
public boolean isGuildOnly()
Returns whenever this command should be only executed in guild.- Returns:
true
if guild only,false
otherwise
-
execute
public boolean execute(CommandExecutionContext context, CommandArguments args)
Executes the command with the specified context and arguments.- Parameters:
context
- contextargs
- arguments- Returns:
- command execution success
-
-