Class CommandBus
java.lang.Object
com.github.darksoulq.abyssallib.server.command.CommandBus
Manages registration and lifecycle of custom commands using the Brigadier command system.
This class is intended to be initialized once via
init(CommandDispatcher)-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic com.mojang.brigadier.CommandDispatcher<io.papermc.paper.command.brigadier.CommandSourceStack> Retrieves the command dispatcher used for registering commands.static voidinit(com.mojang.brigadier.CommandDispatcher<io.papermc.paper.command.brigadier.CommandSourceStack> dispatcher) Initializes theCommandBuswith the given BrigadierCommandDispatcher.static voidRegisters all methods in the given handler class that are annotated withCommand.static voidReloads all previously registered commands by unregistering and re-registering them.
-
Constructor Details
-
CommandBus
public CommandBus()
-
-
Method Details
-
init
public static void init(com.mojang.brigadier.CommandDispatcher<io.papermc.paper.command.brigadier.CommandSourceStack> dispatcher) Initializes theCommandBuswith the given BrigadierCommandDispatcher.- Parameters:
dispatcher- The command dispatcher used to register commands.
-
register
Registers all methods in the given handler class that are annotated withCommand. Each method must accept a single parameter of typeLiteralArgumentBuilder.- Parameters:
pluginId- The mod ID this command belongs to.handler- The object containing command methods.
-
reloadAll
public static void reloadAll()Reloads all previously registered commands by unregistering and re-registering them. (handled in /abyssallib reload) -
getDispatcher
public static com.mojang.brigadier.CommandDispatcher<io.papermc.paper.command.brigadier.CommandSourceStack> getDispatcher()Retrieves the command dispatcher used for registering commands.- Returns:
- The command dispatcher.
-