Fix typo and interact bug?

This commit is contained in:
NO411 2022-03-27 18:08:43 +02:00
parent 63a156c30c
commit 6afe7cfb58
2 changed files with 20 additions and 18 deletions

View File

@ -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

View File

@ -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
if not player then
return
end
local meta = player:get_meta()
if priv == "fly" then
meta:set_int("fly_changed", 1)
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)
meta:set_int("mcl_privs:interact_revoked", 1)
else
meta:set_int("ineract_revoked", 0)
end
meta:set_int("mcl_privs:interact_revoked", 0)
end
end
end)