From fa7358bb98f9e412235658331dbf97337855c259 Mon Sep 17 00:00:00 2001 From: iiAhmedYT <61851106+iiAhmedYT@users.noreply.github.com> Date: Mon, 4 Nov 2024 07:38:01 +0200 Subject: [PATCH] Add CommandRegistrar#registerCommands --- .../dev/velix/imperat/CommandRegistrar.java | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/dev/velix/imperat/CommandRegistrar.java b/core/src/main/java/dev/velix/imperat/CommandRegistrar.java index 41c0ec4..a32341a 100644 --- a/core/src/main/java/dev/velix/imperat/CommandRegistrar.java +++ b/core/src/main/java/dev/velix/imperat/CommandRegistrar.java @@ -10,12 +10,24 @@ public sealed interface CommandRegistrar permits Imperat { /** - * Registering a command into the dispatcher + * Registers a command into the dispatcher * * @param command the command to register */ void registerCommand(Command command); + /** + * Registers some commands into the dispatcher + * + * @param commands the commands to register + */ + @SuppressWarnings("all") + default void registerCommands(Command... commands) { + for (final var command : commands) { + this.registerCommand(command); + } + } + /** * Registers a command class built by the * annotations using a parser @@ -24,6 +36,18 @@ public sealed interface CommandRegistrar permits Imperat { */ void registerCommand(Object command); + /** + * Registers some commands into the dispatcher + * annotations using a parser + * + * @param commands the commands to register + */ + default void registerCommands(Object... commands) { + for (final var command : commands) { + this.registerCommand(command); + } + } + /** * Unregisters a command from the internal registry *