Fix revoke callbacks being run for false values passed to set_privileges

This commit is contained in:
Lars Mueller 2024-01-22 21:57:30 +01:00
parent afc48cf224
commit f0180ad488

@ -102,14 +102,14 @@ core.builtin_auth_handler = {
core.log('deprecated', "non-`true` value given to `minetest.set_player_privs`") core.log('deprecated', "non-`true` value given to `minetest.set_player_privs`")
end end
-- Run grant callbacks -- Run grant callbacks
if not prev_privs[priv] then if prev_privs[priv] == nil then
core.run_priv_callbacks(name, priv, nil, "grant") core.run_priv_callbacks(name, priv, nil, "grant")
end end
end end
-- Run revoke callbacks -- Run revoke callbacks
for priv, _ in pairs(prev_privs) do for priv, _ in pairs(prev_privs) do
if not privileges[priv] then if privileges[priv] == nil then
core.run_priv_callbacks(name, priv, nil, "revoke") core.run_priv_callbacks(name, priv, nil, "revoke")
end end
end end