From a410d173069baf3d38f5fe5a704e4db562e5dd8a Mon Sep 17 00:00:00 2001 From: NO11 Date: Thu, 30 Sep 2021 20:14:13 +0000 Subject: [PATCH] Fix that all of new players' default_privs are removed --- mods/MISC/mcl_privs/init.lua | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/mods/MISC/mcl_privs/init.lua b/mods/MISC/mcl_privs/init.lua index c63f7c5c5..f06ff3582 100644 --- a/mods/MISC/mcl_privs/init.lua +++ b/mods/MISC/mcl_privs/init.lua @@ -6,7 +6,6 @@ minetest.register_privilege("maphack", { minetest.register_on_joinplayer(function(player) local name = player:get_player_name() - local meta = player:get_meta() if meta:get_int("fly_changed") == 1 then return end @@ -14,12 +13,12 @@ minetest.register_on_joinplayer(function(player) if minetest.is_creative_enabled(name) then fly = true end - minetest.set_player_privs(name, { - fly = fly, - }) + local player_privs = minetest.get_player_privs(name) + player_privs.fly = fly + minetest.set_player_privs(name, player_privs) end) -for _, action in pairs({ "grant", "revoke" }) do +for _, action in pairs({"grant", "revoke"}) do minetest["register_on_priv_" .. action](function(name, _, priv) if priv == "fly" then local player = minetest.get_player_by_name(name)