From 8697b38d60325f289eb75fd19b83e86e877946bc Mon Sep 17 00:00:00 2001 From: NO11 Date: Mon, 27 Sep 2021 20:00:11 +0000 Subject: [PATCH] Remove on_newplayer ... --- mods/MISC/mcl_privs/init.lua | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/mods/MISC/mcl_privs/init.lua b/mods/MISC/mcl_privs/init.lua index 302557f867..c63f7c5c5b 100644 --- a/mods/MISC/mcl_privs/init.lua +++ b/mods/MISC/mcl_privs/init.lua @@ -4,9 +4,12 @@ minetest.register_privilege("maphack", { description = S("Can place and use advanced blocks like mob spawners, command blocks and barriers."), }) -minetest.register_on_newplayer(function(player) +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 + local fly = nil if minetest.is_creative_enabled(name) then fly = true @@ -15,3 +18,13 @@ minetest.register_on_newplayer(function(player) fly = fly, }) 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 \ No newline at end of file