1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Lua API: Add register_on_chatcommand to SSM and CSM (#7862)

Allows catching a chatcommand call just after the command and the
parameters are parsed but before its existence is checked and before the
corresponding function is run. Returning `true` from a callback function
will prevent default handling of the command leaving mods to handle the
command manually.
This commit is contained in:
Elijah Duffy 2020-10-03 09:38:08 -07:00 committed by GitHub
parent 0750047919
commit 7d3641021b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 29 additions and 0 deletions

View file

@ -4606,6 +4606,11 @@ Call these functions only at load time!
* Called always when a player says something
* Return `true` to mark the message as handled, which means that it will
not be sent to other players.
* `minetest.register_on_chatcommand(function(name, command, params))`
* Called always when a chatcommand is triggered, before `minetest.registered_chatcommands`
is checked to see if the command exists, but after the input is parsed.
* Return `true` to mark the command as handled, which means that the default
handlers will be prevented.
* `minetest.register_on_player_receive_fields(function(player, formname, fields))`
* Called when the server received input from `player` in a formspec with
the given `formname`. Specifically, this is called on any of the