Interface CommandRegistrationCustomizer


public interface CommandRegistrationCustomizer
Customizes automatic command registration in ZetaCorePlugin.

Provide implementations as services or beans; all of them are applied. A command is only registered if every customizer allows it.

 @Service
 public class CommandToggles implements CommandRegistrationCustomizer {
     private final CommandsConfig config;

     public CommandToggles(CommandsConfig config) {
         this.config = config;
     }

     @Override
     public boolean shouldRegister(String commandName) {
         return config.isEnabled(commandName);
     }
 }
 
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    onCommandsRegistered(List<String> registeredCommands)
    Called once after all commands are registered.
    default boolean
    shouldRegister(String commandName)
    Decides whether a command should be registered.
  • Method Details

    • shouldRegister

      default boolean shouldRegister(String commandName)
      Decides whether a command should be registered.
      Parameters:
      commandName - The command name, as declared on Command.
      Returns:
      False to skip the command. Defaults to true.
    • onCommandsRegistered

      default void onCommandsRegistered(List<String> registeredCommands)
      Called once after all commands are registered.
      Parameters:
      registeredCommands - The names of the registered commands, sorted alphabetically.