mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-12-23 00:19:32 +01:00
Use on_newplayer
This commit is contained in:
parent
f10d579d9c
commit
89e90b13eb
1 changed files with 1 additions and 14 deletions
|
@ -4,12 +4,9 @@ minetest.register_privilege("maphack", {
|
|||
description = S("Can place and use advanced blocks like mob spawners, command blocks and barriers."),
|
||||
})
|
||||
|
||||
minetest.register_on_joinplayer(function(player)
|
||||
minetest.register_on_newplayer(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
|
||||
|
@ -18,13 +15,3 @@ minetest.register_on_joinplayer(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
|
Loading…
Reference in a new issue