Package com.mrivanplays.jdcf
Class Command
- java.lang.Object
-
- com.mrivanplays.jdcf.Command
-
- Direct Known Subclasses:
CommandHelp
,CommandPrefix
,CommandShutdown
public abstract class Command extends java.lang.Object
Represents a command. Extending classes may use the annotations located incom.mrivanplays.jdcf.data
to give more information about the command itself (aliases, description, usage)
-
-
Constructor Summary
Constructors Constructor Description Command()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract boolean
execute(@NotNull CommandExecutionContext context, @NotNull CommandArguments args)
JDCF calls this method when the command was triggered from a message.boolean
hasPermission(@NotNull PermissionCheckContext context)
An overridable method which checks if the member has the required permission to execute the command.
-
-
-
Method Detail
-
hasPermission
public boolean hasPermission(@NotNull @NotNull PermissionCheckContext context)
An overridable method which checks if the member has the required permission to execute the command.- Parameters:
context
- permission check context- Returns:
true
if has,false
otherwise
-
execute
public abstract boolean execute(@NotNull @NotNull CommandExecutionContext context, @NotNull @NotNull CommandArguments args)
JDCF calls this method when the command was triggered from a message. This will always happen when the command name was prefixed with the bot's prefix. According to settings inCommandManager
it also might happen when the bot was mentioned except of the bot prefix. Also according to settings inCommandManager
prefixes may vary between servers.- Parameters:
context
- data about the triggerargs
- the arguments typed when triggered- Returns:
- command execution success state
-
-