Interface CommandApi
public interface CommandApi
Registers and unregisters Plex commands.
Register commands during module load. Paper can then add them to the command list for the current server run. Module reloads on Paper reload datapacks to apply new command registrations. Folia requires a restart.
Modules must use the methods on PlexModule so that
Plex can unregister their commands during module unload.
-
Method Summary
Modifier and TypeMethodDescriptionbooleandispatchAsConsole(UUID identityId, String identityName, String command, Consumer<? super net.kyori.adventure.text.Component> feedback) Runs a command as the console and records the given actor.voidregister(PlexCommand command) Registers a command with Plex.Returns the commands tracked by Plex.booleanChecks if command changes require Paper to rebuild its command list.voidunregister(PlexCommand command) Unregisters a command from Plex.
-
Method Details
-
register
Registers a command with Plex.- Parameters:
command- command to register
-
unregister
Unregisters a command from Plex.Plex removes this command's registered labels from Paper's live dispatcher. Labels replaced by another command remain unchanged.
- Parameters:
command- command to unregister
-
registeredCommands
List<PlexCommand> registeredCommands()Returns the commands tracked by Plex.- Returns:
- registered commands
-
requiresLifecycleReload
boolean requiresLifecycleReload()Checks if command changes require Paper to rebuild its command list.- Returns:
trueif Paper must rebuild the command list
-
dispatchAsConsole
boolean dispatchAsConsole(UUID identityId, String identityName, String command, Consumer<? super net.kyori.adventure.text.Component> feedback) Runs a command as the console and records the given actor. Call this method from the global server thread.- Parameters:
identityId- actor UUIDidentityName- actor namecommand- command line without a leading slashfeedback- receiver for command feedback- Returns:
trueif Paper accepted the command
-