Package org.core.command.argument
Interface ArgumentCommand
- All Known Implementing Classes:
TimingsCommand
public interface ArgumentCommand
An argument command is a command that uses
CommandArgument
as its arguments.-
Method Summary
Modifier and TypeMethodDescriptionList<CommandArgument<?>>
Gets the arguments of the command.Gets a description of the command, designing to inform the user on what the command does.Gets the permission node of the command that is required to run the command.default boolean
hasPermission(CommandSource source)
If the command source has permission to run this commandboolean
run(CommandContext commandContext, String... args)
Runs the command
-
Method Details
-
getArguments
List<CommandArgument<?>> getArguments()Gets the arguments of the command. This should be a list of arguments that do not change- Returns:
- A list of command arguments
-
getDescription
String getDescription()Gets a description of the command, designing to inform the user on what the command does.- Returns:
- A string of the description
-
getPermissionNode
Optional<Permission> getPermissionNode()Gets the permission node of the command that is required to run the command. If a permission is not required then this should returnOptional.empty()
When checking to see if this command has permission you should use
hasPermission(CommandSource)
- Returns:
- The permission to the command
-
run
Runs the command- Parameters:
commandContext
- The command context for this commandargs
- The arguments for the command- Returns:
- if the command should show the usage (false to show)
- Throws:
NotEnoughArguments
- If the arguments provided are not enough for the command, this will throw
-
hasPermission
If the command source has permission to run this command- Parameters:
source
- The command source to compare- Returns:
- If the source has permission to run the command
-