Skip to content

Commit

Permalink
Add CommandRegistrar#registerCommands
Browse files Browse the repository at this point in the history
  • Loading branch information
iiAhmedYT committed Nov 4, 2024
1 parent 6d98bfe commit fa7358b
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion core/src/main/java/dev/velix/imperat/CommandRegistrar.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,24 @@
public sealed interface CommandRegistrar<S extends Source> permits Imperat {

/**
* Registering a command into the dispatcher
* Registers a command into the dispatcher
*
* @param command the command to register
*/
void registerCommand(Command<S> command);

/**
* Registers some commands into the dispatcher
*
* @param commands the commands to register
*/
@SuppressWarnings("all")
default void registerCommands(Command<S>... commands) {
for (final var command : commands) {
this.registerCommand(command);
}
}

/**
* Registers a command class built by the
* annotations using a parser
Expand All @@ -24,6 +36,18 @@ public sealed interface CommandRegistrar<S extends Source> 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
*
Expand Down

0 comments on commit fa7358b

Please sign in to comment.