ide-helper: add PrivilegeDefinition docs.
This commit is contained in:
39
definitions/PrivilegeDefinition.lua
Normal file
39
definitions/PrivilegeDefinition.lua
Normal file
@@ -0,0 +1,39 @@
|
||||
--- @class PrivilegeDefinition
|
||||
local PrivilegeDefinition = {
|
||||
--- @type string Privilege description
|
||||
description = "",
|
||||
|
||||
--- @type string Whether to grant the privilege to singleplayer.
|
||||
give_to_singleplayer = true,
|
||||
|
||||
--- Whether to grant the privilege to the server admin.
|
||||
--- Uses value of 'give_to_singleplayer' by default.
|
||||
--- @type boolean
|
||||
give_to_admin = true,
|
||||
|
||||
--- Called when given to player 'name' by 'granter_name'.
|
||||
--- 'granter_name' will be nil if the priv was granted by a mod.
|
||||
---
|
||||
--- Note that it will be called twice if a player is responsible,
|
||||
--- once with the player name, and then with a nil player name.
|
||||
---
|
||||
--- Return `true` to stop register_on_priv_grant or revoke being called.
|
||||
---
|
||||
--- @param name string for whom priv was granted
|
||||
--- @param granter_name string who gives the priv
|
||||
--- @return boolean
|
||||
on_grant = function(name, granter_name) end,
|
||||
|
||||
--- Called when taken from player 'name' by 'revoker_name'.
|
||||
--- 'revoker_name' will be nil if the priv was revoked by a mod.
|
||||
---
|
||||
--- Note that it will be called twice if a player is responsible,
|
||||
--- once with the player name, and then with a nil player name.
|
||||
---
|
||||
--- Return `true` to stop register_on_priv_grant or revoke being called.
|
||||
---
|
||||
--- @param name string for whom priv was granted
|
||||
--- @param revoker_name string who gives the priv
|
||||
--- @return boolean
|
||||
on_revoke = function(name, revoker_name) end,
|
||||
}
|
||||
@@ -394,6 +394,8 @@ function minetest.unregister_chatcommand(name) end
|
||||
--- minetest.conf setting.
|
||||
---
|
||||
--- [View in lua_api.txt](https://github.com/minetest/minetest/blob/5.4.1/doc/lua_api.txt#L4548-L4554)
|
||||
--- @param name string
|
||||
--- @param definition string|PrivilegeDefinition
|
||||
function minetest.register_privilege(name, definition) end
|
||||
--- * Registers an auth handler that overrides the builtin one.
|
||||
--- * This function can be called by a single mod once only.
|
||||
|
||||
Reference in New Issue
Block a user