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/mpas well. - execute -
(args: string[], sender: { username: string; uuid: string }) => void | Promise<void>.argsis everything after the command (e.g./myplugin on→args = ['on']).
Unregistering
If you need to remove a command at runtime:Example (from auto-glhf)
The auto-glhf example registers/glhf with subcommands:
ctx.client, ctx.storage, ctx.gameState, etc., inside execute.