priv.lua 1.2 KB

123456789101112131415161718192021222324252627
  1. ---@meta
  2. ---Privilege definition
  3. -----------------------
  4. -- Used by `minetest.register_privilege`.
  5. ---@class mt.PrivDef
  6. ---@field description string|nil Privilege description.
  7. -- Whether to grant the privilege to singleplayer.
  8. ---@field give_to_singleplayer boolean|nil
  9. -- Whether to grant the privilege to the server admin.
  10. -- Uses value of `give_to_singleplayer` by default.
  11. ---@field give_to_admin boolean|nil
  12. -- Called when given to player `name` by `granter_name`.
  13. -- `granter_name` will be nil if the priv was granted by a mod.
  14. --
  15. -- * Note that this callback will be called twice if a player is
  16. -- responsible, once with the player name, and then with a nil player name.
  17. -- * Return true here to stop `register_on_priv_grant` or `revoke` being called.
  18. ---@field on_grant nil|fun(name:string, granter_name:string|nil):boolean|nil
  19. -- Called when taken from player `name` by `revoker_name`.
  20. -- `revoker_name` will be nil if the priv was revoked by a mod.
  21. --
  22. -- * Note that this callback will be called twice if a player is
  23. -- responsible, once with the player name, and then with a nil player name.
  24. -- * Return true here to stop `register_on_priv_grant` or `revoke` being called.
  25. ---@field on_revoke nil|fun(name:string, revoker_name:string|nil):boolean|nil