public interface CommandManager
| Modifier and Type | Method and Description |
|---|---|
boolean |
execute(CommandSource source,
String cmdLine)
Deprecated.
this method blocks the current thread during the event call and
the command execution. Prefer
executeAsync(CommandSource, String)
instead. |
CompletableFuture<Boolean> |
executeAsync(CommandSource source,
String cmdLine)
Attempts to asynchronously execute a command from the given
cmdLine. |
boolean |
executeImmediately(CommandSource source,
String cmdLine)
Deprecated.
this methods blocks the current thread during the command execution.
Prefer
executeImmediatelyAsync(CommandSource, String) instead. |
CompletableFuture<Boolean> |
executeImmediatelyAsync(CommandSource source,
String cmdLine)
Attempts to asynchronously execute a command from the given
cmdLine
without firing a CommandExecuteEvent. |
boolean |
hasCommand(String alias)
Returns whether the given alias is registered on this manager.
|
CommandMeta.Builder |
metaBuilder(BrigadierCommand command)
Returns a builder to create a
CommandMeta for
the given Brigadier command. |
CommandMeta.Builder |
metaBuilder(String alias)
Returns a builder to create a
CommandMeta with
the given alias. |
void |
register(BrigadierCommand command)
Registers the specified Brigadier command.
|
void |
register(CommandMeta meta,
Command command)
Registers the specified command with the given metadata.
|
void |
register(Command command,
String... aliases)
Deprecated.
This method requires at least one alias, but this is only enforced at runtime.
Prefer
register(String, Command, String...) |
void |
register(String alias,
Command command,
String... otherAliases)
Registers the specified command with the specified aliases.
|
void |
unregister(String alias)
Unregisters the specified command alias from the manager, if registered.
|
CommandMeta.Builder metaBuilder(String alias)
CommandMeta with
the given alias.alias - the first command aliasCommandMeta builderCommandMeta.Builder metaBuilder(BrigadierCommand command)
CommandMeta for
the given Brigadier command.command - the commandCommandMeta builder@Deprecated void register(Command command, String... aliases)
register(String, Command, String...)command - the command to registeraliases - the command aliasesIllegalArgumentException - if one of the given aliases is already registeredvoid register(String alias, Command command, String... otherAliases)
alias - the first command aliascommand - the command to registerotherAliases - additional aliasesIllegalArgumentException - if one of the given aliases is already registeredvoid register(BrigadierCommand command)
command - the command to registerIllegalArgumentException - if the node alias is already registeredvoid register(CommandMeta meta, Command command)
meta - the command metadatacommand - the command to registerIllegalArgumentException - if one of the given aliases is already registeredvoid unregister(String alias)
alias - the command alias to unregister@Deprecated boolean execute(CommandSource source, String cmdLine)
executeAsync(CommandSource, String)
instead.cmdLine in
a blocking fashion.source - the source to execute the command forcmdLine - the command to runtrue if the command was found and executed@Deprecated boolean executeImmediately(CommandSource source, String cmdLine)
executeImmediatelyAsync(CommandSource, String) instead.cmdLine without
firing a CommandExecuteEvent in a blocking fashion.source - the source to execute the command forcmdLine - the command to runtrue if the command was found and executedCompletableFuture<Boolean> executeAsync(CommandSource source, String cmdLine)
cmdLine.source - the source to execute the command forcmdLine - the command to runCompletableFuture<Boolean> executeImmediatelyAsync(CommandSource source, String cmdLine)
cmdLine
without firing a CommandExecuteEvent.source - the source to execute the command forcmdLine - the command to runboolean hasCommand(String alias)
alias - the command alias to checktrue if the alias is registered