Class CommandHandler<T>
- java.lang.Object
-
- com.github.rainestormee.jdacommand.CommandHandler<T>
-
public class CommandHandler<T> extends java.lang.ObjectTheCommandHandlerwhich deals with the registeredAbstractCommands.- Since:
- 1.0.0
-
-
Constructor Summary
Constructors Constructor Description CommandHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidexecute(AbstractCommand command, T message, java.lang.String args)Method which attempts to execute the givenAbstractCommand.voidfindAndExecute(java.lang.String trigger, T message, java.lang.String args)A method which callsfindCommand(String), and then#execute(AbstractCommand, T, String)if the foundAbstractCommandis notnullAbstractCommandfindCommand(java.lang.String trigger)Method which attempts to find aAbstractCommandfrom the given triggerjava.util.Set<AbstractCommand>getCommands()A method to get all of theAbstractCommands registered with thisCommandHandlervoidregisterCommand(AbstractCommand command)A method to register aAbstractCommandwith thisCommandHandler.voidregisterCommands(AbstractCommand... commands)A method to registerAbstractCommands with thisCommandHandler.voidregisterCommands(java.util.Set<AbstractCommand> commands)A method to registerAbstractCommands with thisCommandHandler.voidunregisterCommand(AbstractCommand command)A method to unregister aAbstractCommandwith thisCommandHandler.voidunregisterCommands(AbstractCommand... commands)A method to unregisterAbstractCommands with thisCommandHandler.voidunregisterCommands(java.util.Set<AbstractCommand> commands)A method to unregisterAbstractCommands with thisCommandHandler.
-
-
-
Method Detail
-
registerCommands
public void registerCommands(java.util.Set<AbstractCommand> commands)
A method to registerAbstractCommands with thisCommandHandler.- Parameters:
commands- TheAbstractCommands to register.- Since:
- 1.0.0
- See Also:
registerCommand(AbstractCommand)
-
registerCommands
public void registerCommands(AbstractCommand... commands)
A method to registerAbstractCommands with thisCommandHandler.- Parameters:
commands- TheAbstractCommands to register.- Since:
- 1.0.1
- See Also:
registerCommand(AbstractCommand),registerCommands(Set)
-
registerCommand
public void registerCommand(AbstractCommand command)
A method to register aAbstractCommandwith thisCommandHandler.- Parameters:
command- TheAbstractCommandto register.- Since:
- 1.0.1
- See Also:
registerCommands(Set)
-
unregisterCommands
public void unregisterCommands(java.util.Set<AbstractCommand> commands)
A method to unregisterAbstractCommands with thisCommandHandler.- Parameters:
commands- The commands to unregister.- Since:
- 1.0.1
- See Also:
unregisterCommand(AbstractCommand),unregisterCommands(Set)
-
unregisterCommands
public void unregisterCommands(AbstractCommand... commands)
A method to unregisterAbstractCommands with thisCommandHandler.- Parameters:
commands- The commands to unregister.- Since:
- 1.0.1
- See Also:
unregisterCommand(AbstractCommand),unregisterCommands(Set)
-
unregisterCommand
public void unregisterCommand(AbstractCommand command)
A method to unregister aAbstractCommandwith thisCommandHandler.- Parameters:
command- The command to unregister.- Since:
- 1.0.1
- See Also:
unregisterCommands(Set),unregisterCommands(AbstractCommand...)
-
getCommands
public java.util.Set<AbstractCommand> getCommands()
A method to get all of theAbstractCommands registered with thisCommandHandler- Returns:
- All of the commands registered with this command handler.
- Since:
- 1.0.1
-
findCommand
public AbstractCommand findCommand(java.lang.String trigger)
Method which attempts to find aAbstractCommandfrom the given trigger- Parameters:
trigger- The trigger of the command to find.- Returns:
- The
AbstractCommandthat was found, sometimesnull - Since:
- 1.0.0
-
execute
public void execute(AbstractCommand command, T message, java.lang.String args)
Method which attempts to execute the givenAbstractCommand.- Parameters:
command- TheAbstractCommandto execute.message- TheCommandHandlerwhich triggered the command.args- The arguments of the command.- Since:
- 1.0.0
-
findAndExecute
public void findAndExecute(java.lang.String trigger, T message, java.lang.String args)A method which callsfindCommand(String), and then#execute(AbstractCommand, T, String)if the foundAbstractCommandis notnull- Parameters:
trigger- The trigger of the command.message- TheCommandHandlerwhich triggered the command.args- The args of the command.- Since:
- 1.0.1
- See Also:
findCommand(String),#execute(AbstractCommand, T, String)
-
-