Skip to main content

Commands

Plugins register custom chat commands that the player can run with /commandname. The proxy routes these to your plugin’s execute function.

Registering a command

  • name - The main command name (e.g. myplugin/myplugin). Use lowercase.
  • description - Shown in help (e.g. /dhelp).
  • usage - Optional; shown in help.
  • aliases - Optional; e.g. ['mp'] allows /mp as well.
  • execute - (args: string[], sender: { username: string; uuid: string }) => void | Promise<void>. args is everything after the command (e.g. /myplugin onargs = ['on']).

Unregistering

If you need to remove a command at runtime:
Aliases are unregistered automatically when the plugin unloads. You don’t need to unregister for normal shutdown - the proxy cleans up all plugin commands when a plugin is unloaded.

Example (from auto-glhf)

The auto-glhf example registers /glhf with subcommands:
Commands run in the same context as the rest of your plugin; you can use ctx.client, ctx.storage, ctx.gameState, etc., inside execute.