1
0
Fork 0

Fix that all of new players' default_privs are removed

This commit is contained in:
NO11 2021-09-30 20:14:13 +00:00
parent 8697b38d60
commit a410d17306
1 changed files with 4 additions and 5 deletions

View File

@ -6,7 +6,6 @@ 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() local meta = player:get_meta()
if meta:get_int("fly_changed") == 1 then return end 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 if minetest.is_creative_enabled(name) then
fly = true fly = true
end end
minetest.set_player_privs(name, { local player_privs = minetest.get_player_privs(name)
fly = fly, player_privs.fly = fly
}) minetest.set_player_privs(name, player_privs)
end) end)
for _, action in pairs({ "grant", "revoke" }) do for _, action in pairs({"grant", "revoke"}) do
minetest["register_on_priv_" .. action](function(name, _, priv) minetest["register_on_priv_" .. action](function(name, _, priv)
if priv == "fly" then if priv == "fly" then
local player = minetest.get_player_by_name(name) local player = minetest.get_player_by_name(name)