ScriptCommandRegistry

Registry for managing script-defined commands with hot-reload support.

This object provides functionality to register, track, and remove commands that are defined by scripts. It supports hot-reloading by tracking which commands belong to which script owners and properly cleaning them up during reload operations.

Commands registered through this registry are "managed", meaning they can be replaced or removed during script reloads without affecting other commands in the game.

Functions

Link copied to clipboard
fun beginReload(server: MinecraftServer)

Begins a reload cycle by removing all managed commands.

Link copied to clipboard
fun register(server: MinecraftServer, rootBuilder: LiteralArgumentBuilder<CommandSourceStack>)

Registers a new command with the server's command dispatcher.

Link copied to clipboard
fun syncTree(server: MinecraftServer)

Synchronizes the command tree with all connected players.