Package io.manebot.command
Class CommandManager
- java.lang.Object
-
- io.manebot.command.CommandManager
-
public abstract class CommandManager extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
CommandManager.Registration
Command Registrations are a fluent way of aliasing commands.
-
Constructor Summary
Constructors Constructor Description CommandManager()
-
Method Summary
Modifier and Type Method Description abstract CommandExecutor
getExecutor(java.lang.String label)
Gets a command executor by its label.abstract java.util.Collection<CommandManager.Registration>
getRegistrations()
Gets a collection of command registrations, essentially a tuple of executors to labels.abstract CommandManager.Registration
registerExecutor(java.lang.String label, CommandExecutor executor)
Registers a command executor to the system.abstract void
unregisterExecutor(java.lang.String label)
Unregisters an existing command executor.
-
-
-
Method Detail
-
registerExecutor
public abstract CommandManager.Registration registerExecutor(java.lang.String label, CommandExecutor executor)
Registers a command executor to the system. In manebot, command format is as follows: .label arguments Where "label" is a static command label, such as "ping", and "arguments" is a space-delimited array of strings.- Parameters:
label
- label to map an executor to.executor
- CommandExecutor to fire for the given label.- Returns:
- Registration instance, an object which permits alias building.
-
unregisterExecutor
public abstract void unregisterExecutor(java.lang.String label)
Unregisters an existing command executor.- Parameters:
label
- label to unregister.
-
getExecutor
public abstract CommandExecutor getExecutor(java.lang.String label)
Gets a command executor by its label.- Parameters:
label
- label to find.- Returns:
- CommandExecutor instance if one is found, null otherwise.
-
getRegistrations
public abstract java.util.Collection<CommandManager.Registration> getRegistrations()
Gets a collection of command registrations, essentially a tuple of executors to labels.- Returns:
- immutable collection of command registrations.
-
-