Only change fly priv on join if it wasn't revoked or granted
This commit is contained in:
parent
fed43586f2
commit
f10d579d9c
|
@ -6,6 +6,10 @@ minetest.register_privilege("maphack", {
|
||||||
|
|
||||||
minetest.register_on_joinplayer(function(player)
|
minetest.register_on_joinplayer(function(player)
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
|
|
||||||
|
local meta = player:get_meta()
|
||||||
|
if meta:get_int("fly_changed") == 1 then return end
|
||||||
|
|
||||||
local fly = nil
|
local fly = nil
|
||||||
if minetest.is_creative_enabled(name) then
|
if minetest.is_creative_enabled(name) then
|
||||||
fly = true
|
fly = true
|
||||||
|
@ -14,3 +18,13 @@ minetest.register_on_joinplayer(function(player)
|
||||||
fly = fly,
|
fly = fly,
|
||||||
})
|
})
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
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)
|
||||||
|
local meta = player:get_meta()
|
||||||
|
meta:set_int("fly_changed", 1)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
Loading…
Reference in New Issue
Block a user