diff options
author | Loïc Blot <nerzhul@users.noreply.github.com> | 2017-09-04 22:08:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-04 22:08:59 +0200 |
commit | 40dd03e328ff0ae36338615114cb38879752756e (patch) | |
tree | 0ffe5ded06cce82f2b528284c1b5f5aba73f203e /builtin/game | |
parent | c05228fa6d446022cdf675865f9a420c95619313 (diff) | |
download | minetest-40dd03e328ff0ae36338615114cb38879752756e.tar.gz minetest-40dd03e328ff0ae36338615114cb38879752756e.tar.bz2 minetest-40dd03e328ff0ae36338615114cb38879752756e.zip |
Implement minetest.register_can_bypass_userlimit (#6369)
* Implement minetest.register_on_userlimit_check
This new callback permits to bypass the max_users parameter with new mods condition, based on player name or IP
Only one mod needs to permit it.
Move core part for builtin privileges checks to builtin
Diffstat (limited to 'builtin/game')
-rw-r--r-- | builtin/game/privileges.lua | 5 | ||||
-rw-r--r-- | builtin/game/register.lua | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/builtin/game/privileges.lua b/builtin/game/privileges.lua index fb53423eb..e9b2df54c 100644 --- a/builtin/game/privileges.lua +++ b/builtin/game/privileges.lua @@ -86,3 +86,8 @@ core.register_privilege("debug", { description = "Allows enabling various debug options that may affect gameplay", give_to_singleplayer = false, }) + +core.register_can_bypass_userlimit(function(name, ip) + local privs = core.get_player_privs(name) + return privs["server"] or privs["ban"] or privs["privs"] or privs["password"] +end) diff --git a/builtin/game/register.lua b/builtin/game/register.lua index 1f355c7e5..e0073fc03 100644 --- a/builtin/game/register.lua +++ b/builtin/game/register.lua @@ -581,6 +581,7 @@ core.registered_on_item_eats, core.register_on_item_eat = make_registration() core.registered_on_punchplayers, core.register_on_punchplayer = make_registration() core.registered_on_priv_grant, core.register_on_priv_grant = make_registration() core.registered_on_priv_revoke, core.register_on_priv_revoke = make_registration() +core.registered_can_bypass_userlimit, core.register_can_bypass_userlimit = make_registration() -- -- Compatibility for on_mapgen_init() |