Package net.orbyfied.j8.command
Class CommandManager
java.lang.Object
net.orbyfied.j8.command.CommandManager
- Direct Known Subclasses:
BukkitCommandManager,BungeeCommandManager
The engine of the command system.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreates and registers a new command, returning the base to you.abstract voidShould shut down the command engine and clean up any resources.dispatch(Sender sender, String str, SuggestionAccumulator suggestions, Consumer<Context> ctxConsumer) Dispatches a suggestion or invocation request for a command.abstract voidShould prepare the command engine for usage.Get the type resolver.newCommand(String name, Consumer<Node> consumer) protected abstract voidregisterPlatform(Node root) Should do whatever it needs to do when a node gets registered to make it work.setTypeResolver(TypeResolver resolver) Set the type resolver.unregister(Node command) protected abstract voidunregisterPlatform(Node root) Should do whatever it needs to do when a node gets unregistered to make it work.
-
Constructor Details
-
CommandManager
public CommandManager()
-
-
Method Details
-
register
-
unregister
-
setTypeResolver
Set the type resolver.- Parameters:
resolver- It.- Returns:
- This.
-
getTypeResolver
Get the type resolver.- Returns:
- It.
-
registerPlatform
Should do whatever it needs to do when a node gets registered to make it work.- Parameters:
root- The command node.
-
unregisterPlatform
Should do whatever it needs to do when a node gets unregistered to make it work.- Parameters:
root- The command node.
-
enablePlatform
public abstract void enablePlatform()Should prepare the command engine for usage. Called whenever the system is ready for operation. -
disablePlatform
public abstract void disablePlatform()Should shut down the command engine and clean up any resources. -
dispatch
public Context dispatch(Sender sender, String str, SuggestionAccumulator suggestions, Consumer<Context> ctxConsumer) Dispatches a suggestion or invocation request for a command.- Parameters:
sender- The command sender.str- The command string.suggestions- The suggestion builder. If this is null, the request is invocation, otherwise the request will be set to suggestion.ctxConsumer- A consumer for configuring the context.- Returns:
- The context for optional further use.
-
command
Creates and registers a new command, returning the base to you.- Parameters:
name- The name.- Returns:
- The command node.
-
newCommand
-