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 TypeMethodDescriptiondefault voidonCommandsRegistered(List<String> registeredCommands) Called once after all commands are registered.default booleanshouldRegister(String commandName) Decides whether a command should be registered.
-
Method Details
-
shouldRegister
Decides whether a command should be registered.- Parameters:
commandName- The command name, as declared onCommand.- Returns:
- False to skip the command. Defaults to true.
-
onCommandsRegistered
Called once after all commands are registered.- Parameters:
registeredCommands- The names of the registered commands, sorted alphabetically.
-