Package me.s3ns3iw00.jcommands
Class Command
- java.lang.Object
-
- me.s3ns3iw00.jcommands.Command
-
- Direct Known Subclasses:
GlobalCommand
,ServerCommand
public class Command extends java.lang.Object
A class that represents a command
-
-
Constructor Summary
Constructors Constructor Description Command(java.lang.String name, java.lang.String description)
Default constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addArgument(Argument argument)
Adds an argument to the commandvoid
addArgument(Argument... arguments)
Adds arguments to the commandvoid
addConcatenator(Concatenator concatenator, Argument... arguments)
Adds a concatenator to the command Every argument in the list must belong to this command, otherwise the concatenation won't proceedvoid
addPermissions(org.javacord.api.entity.permission.PermissionType... permissionTypes)
Adds permissions that will be applied on the command Users will need these permissions in the specific channel to use the commandjava.util.Optional<CommandActionEventListener>
getActionListener()
Gets the action listenerjava.util.List<Argument>
getArguments()
java.util.Map<Concatenator,java.util.LinkedList<Argument>>
getConcatenators()
java.util.Set<org.javacord.api.entity.permission.PermissionType>
getDefaultPermissions()
java.lang.String
getDescription()
java.lang.String
getName()
boolean
isNsfw()
boolean
isOnlyForAdministrators()
void
setNsfw()
Sets the command age-restricted NOTE: this cannot be updated for now, so it only takes effect at the creation of the commandvoid
setOnAction(CommandActionEventListener listener)
Sets the action listenervoid
setOnlyForAdministrators()
Sets the command available only for administrators by default
-
-
-
Constructor Detail
-
Command
public Command(java.lang.String name, java.lang.String description)
Default constructor- Parameters:
name
- the name of the command Its length must between 1 and 32 Can contain only: - word characters - numbers - '-' charactersdescription
- the description of the command Its length must between 1 and 100
-
-
Method Detail
-
addArgument
public void addArgument(Argument argument)
Adds an argument to the command- Parameters:
argument
- the argument
-
addArgument
public void addArgument(Argument... arguments)
Adds arguments to the command- Parameters:
arguments
- a list of argument
-
addConcatenator
public void addConcatenator(Concatenator concatenator, Argument... arguments)
Adds a concatenator to the command Every argument in the list must belong to this command, otherwise the concatenation won't proceed- Parameters:
concatenator
- the concatenatorarguments
- the list of arguments
-
addPermissions
public void addPermissions(org.javacord.api.entity.permission.PermissionType... permissionTypes)
Adds permissions that will be applied on the command Users will need these permissions in the specific channel to use the command- Parameters:
permissionTypes
- a list ofPermissionType
-
setOnlyForAdministrators
public void setOnlyForAdministrators()
Sets the command available only for administrators by default
-
setNsfw
public void setNsfw()
Sets the command age-restricted NOTE: this cannot be updated for now, so it only takes effect at the creation of the command
-
setOnAction
public void setOnAction(CommandActionEventListener listener)
Sets the action listener- Parameters:
listener
- the listener
-
getName
public java.lang.String getName()
- Returns:
- the command's name
-
getDescription
public java.lang.String getDescription()
- Returns:
- the command's description
-
getArguments
public java.util.List<Argument> getArguments()
- Returns:
- the list of the arguments
-
getConcatenators
public java.util.Map<Concatenator,java.util.LinkedList<Argument>> getConcatenators()
- Returns:
- the map of concatenators
-
getDefaultPermissions
public java.util.Set<org.javacord.api.entity.permission.PermissionType> getDefaultPermissions()
-
isOnlyForAdministrators
public boolean isOnlyForAdministrators()
-
isNsfw
public boolean isNsfw()
-
getActionListener
public java.util.Optional<CommandActionEventListener> getActionListener()
Gets the action listener- Returns:
Optional.empty()
when action listener is not specified, otherwiseOptional.of(Object)
with the listener
-
-