From 2274b426a59a211a2cff6a77478a8d2157406124 Mon Sep 17 00:00:00 2001 From: Jean-Patrick Guerrero Date: Sat, 15 May 2021 00:18:47 +0200 Subject: [PATCH] Do things the right way --- init.lua | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/init.lua b/init.lua index 7fbeb68..b4284e0 100644 --- a/init.lua +++ b/init.lua @@ -2769,24 +2769,22 @@ if rawget(_G, "awards") then core.register_on_dieplayer(set_fs) end -local _privs = {"creative", "teleport", "all"} - -core.register_on_chatcommand(function(name, command, params) - if sub(command, 1, 5) == "grant" or sub(command, 1, 6) == "revoke" then - for _, priv in ipairs(_privs) do - if sub(params, -#priv) == priv then - local data = pdata[name] - reset_data(data) - data.favs = {} - break - end - end - end - +core.register_on_chatcommand(function(name) local player = core.get_player_by_name(name) after(0, set_fs, player) end) +core.register_on_priv_grant(function(name, _, priv) + if priv == "creative" or priv == "all" then + local data = pdata[name] + reset_data(data) + data.favs = {} + + local player = core.get_player_by_name(name) + after(0, set_fs, player) + end +end) + i3.register_craft_type("digging", { description = ES"Digging", icon = "i3_steelpick.png",