Do things the right way

This commit is contained in:
Jean-Patrick Guerrero 2021-05-15 00:18:47 +02:00
parent 612039cc26
commit 2274b426a5

View File

@ -2769,22 +2769,20 @@ if rawget(_G, "awards") then
core.register_on_dieplayer(set_fs) core.register_on_dieplayer(set_fs)
end end
local _privs = {"creative", "teleport", "all"} core.register_on_chatcommand(function(name)
local player = core.get_player_by_name(name)
after(0, set_fs, player)
end)
core.register_on_chatcommand(function(name, command, params) core.register_on_priv_grant(function(name, _, priv)
if sub(command, 1, 5) == "grant" or sub(command, 1, 6) == "revoke" then if priv == "creative" or priv == "all" then
for _, priv in ipairs(_privs) do
if sub(params, -#priv) == priv then
local data = pdata[name] local data = pdata[name]
reset_data(data) reset_data(data)
data.favs = {} data.favs = {}
break
end
end
end
local player = core.get_player_by_name(name) local player = core.get_player_by_name(name)
after(0, set_fs, player) after(0, set_fs, player)
end
end) end)
i3.register_craft_type("digging", { i3.register_craft_type("digging", {