Class AutoCommandRegistrar
java.lang.Object
com.zetaplugins.zetacore.services.commands.AutoCommandRegistrar
- All Implemented Interfaces:
CommandRegistrar
Manages the registration of commands and tab completers for a plugin.
Use the
AutoRegisterCommand annotation to mark command classes for automatic registration.
Use the AutoRegisterTabCompleter annotation to mark tab completer classes for automatic registration.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder class for constructing an AutoCommandRegistrar instance. -
Constructor Summary
ConstructorsConstructorDescriptionAutoCommandRegistrar(JavaPlugin plugin, String packagePrefix) AutoCommandRegistrar(JavaPlugin plugin, String packagePrefix, String commandNamespace) AutoCommandRegistrar(JavaPlugin plugin, String packagePrefix, String commandNamespace, ManagerRegistry managerRegistry) -
Method Summary
Modifier and TypeMethodDescriptionRegisters all commands annotated withAutoRegisterCommandand tab completers annotated withAutoRegisterTabCompleter.registerAllCommands(Predicate<String> commandNameFilter) Registers all commands annotated withAutoRegisterCommandand tab completers annotated withAutoRegisterTabCompleter.voidregisterCommand(String name, CommandExecutor executor, TabCompleter tabCompleter) Manually registers a command defined in the plugin.ymlMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.zetaplugins.zetacore.services.commands.CommandRegistrar
registerCommand
-
Constructor Details
-
AutoCommandRegistrar
- Parameters:
plugin- The JavaPlugin instance.packagePrefix- The package prefix to scan for annotated classes.
-
AutoCommandRegistrar
- Parameters:
plugin- The JavaPlugin instance.packagePrefix- The package prefix to scan for annotated classes.commandNamespace- The namespace to use for the commands. (e.g. "myplugin" for /myplugin:command)
-
AutoCommandRegistrar
public AutoCommandRegistrar(JavaPlugin plugin, String packagePrefix, String commandNamespace, ManagerRegistry managerRegistry)
-
-
Method Details
-
registerAllCommands
Registers all commands annotated withAutoRegisterCommandand tab completers annotated withAutoRegisterTabCompleter.- Specified by:
registerAllCommandsin interfaceCommandRegistrar- Returns:
- A list of names of the registered commands.
-
registerAllCommands
Registers all commands annotated withAutoRegisterCommandand tab completers annotated withAutoRegisterTabCompleter.- Parameters:
commandNameFilter- A predicate to filter which command names to register.- Returns:
- A list of names of the registered commands.
-
registerCommand
Manually registers a command defined in the plugin.yml- Specified by:
registerCommandin interfaceCommandRegistrar- Parameters:
name- The name of the commandexecutor- The executor of the commandtabCompleter- The tab completer of the command
-