Package com.mrivanplays.jdcf
Class RegisteredCommand
- java.lang.Object
-
- com.mrivanplays.jdcf.RegisteredCommand
-
public final class RegisteredCommand extends java.lang.ObjectRepresents 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 booleanexecute(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 CommandDatagetDataAsCommandData()Returns the data of the command, stored in this object, as a newCommandDataobject.@Nullable java.lang.StringgetDescription()Returns the description of the command (if specified)@NotNull java.lang.StringgetName()Returns the "potential" name of the command.@Nullable java.lang.StringgetUsage()Returns the usage of the command (if specified)booleanhasPermission(@NotNull PermissionCheckContext context)Checks if the specified member has the required permission to execute this command.booleanisGuildOnly()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 newCommandDataobject.- 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:
trueif has permission,falseotherwise
-
isGuildOnly
public boolean isGuildOnly()
Returns whenever this command should be only executed in guild.- Returns:
trueif guild only,falseotherwise
-
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
-
-