From 6afe7cfb58a64baca860d51bf266404eb544461f Mon Sep 17 00:00:00 2001 From: NO411 Date: Sun, 27 Mar 2022 18:08:43 +0200 Subject: [PATCH] Fix typo and interact bug? --- mods/ITEMS/mcl_shields/init.lua | 3 ++- mods/MISC/mcl_privs/init.lua | 35 +++++++++++++++++---------------- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/mods/ITEMS/mcl_shields/init.lua b/mods/ITEMS/mcl_shields/init.lua index 78afae710d..9c6ce8383b 100644 --- a/mods/ITEMS/mcl_shields/init.lua +++ b/mods/ITEMS/mcl_shields/init.lua @@ -204,9 +204,10 @@ local function set_interact(player, interact) return end local meta = player:get_meta() - if meta:get_int("ineract_revoked") ~= 1 then + if meta:get_int("mcl_privs:interact_revoked") ~= 1 then privs.interact = interact minetest.set_player_privs(player_name, privs) + meta:set_int("mcl_privs:interact_revoked",0) end end diff --git a/mods/MISC/mcl_privs/init.lua b/mods/MISC/mcl_privs/init.lua index aa17ba785e..dc3aa0f69a 100644 --- a/mods/MISC/mcl_privs/init.lua +++ b/mods/MISC/mcl_privs/init.lua @@ -7,7 +7,7 @@ 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 + if meta:get_int("mcl_privs:fly_changed") == 1 then return end local fly = nil if minetest.is_creative_enabled(name) then @@ -21,24 +21,25 @@ end) for _, action in pairs({"grant", "revoke"}) do minetest["register_on_priv_" .. action](function(name, _, priv) local player = minetest.get_player_by_name(name) - if player then - local meta = player:get_meta() + if not player then + return + end - if priv == "fly" then - meta:set_int("fly_changed", 1) - end + local meta = player:get_meta() + + if priv == "fly" then + meta:set_int("mcl_privs:fly_changed", 1) + end - --[[ - so e.g. hackers who have been revoked of the interact privilege - will not automatically get the interact privilege through the mcl shields code back - ]] - - if priv == "interact" then - if action == "revoke" then - meta:set_int("ineract_revoked", 1) - else - meta:set_int("ineract_revoked", 0) - end + --[[ + so e.g. hackers who have been revoked of the interact privilege + will not automatically get the interact privilege through the mcl shields code back + ]] + if priv == "interact" then + if action == "revoke" then + meta:set_int("mcl_privs:interact_revoked", 1) + else + meta:set_int("mcl_privs:interact_revoked", 0) end end end)