1
0
mirror of https://github.com/minetest/minetest.git synced 2025-07-05 01:10:22 +02:00

Add on_grant and on_revoke callbacks (#4713)

* Add register_on_priv_grant/revoke, and on_grant/revoke to privs. Call from /grant and /revoke

* Call on_grant and on_revoke callbacks from set_privs
This commit is contained in:
rubenwardy
2017-08-26 07:17:05 +01:00
committed by Loïc Blot
parent ad9677a14f
commit 096ea031de
4 changed files with 45 additions and 3 deletions

View File

@ -2446,6 +2446,12 @@ Call these functions only at load time!
* `definition`: `{ description = "description text", give_to_singleplayer = boolean}`
the default of `give_to_singleplayer` is true
* To allow players with `basic_privs` to grant, see `basic_privs` minetest.conf setting.
* `on_grant(name, granter_name)`: Called when given to player `name` by `granter_name`.
`granter_name` will be nil if the priv was granted by a mod.
* `on_revoke(name, revoker_name)`: Called when taken from player `name` by `revoker_name`.
`revoker_name` will be nil if the priv was revoked by a mod
* Note that the above two callbacks will be called twice if a player is responsible -
once with the player name, and then with a nil player name.
* `minetest.register_authentication_handler(handler)`
* See `minetest.builtin_auth_handler` in `builtin.lua` for reference