From 6f98e88d214477ca058917f53e0327531ada40f9 Mon Sep 17 00:00:00 2001 From: localhost_frssoft Date: Thu, 5 Oct 2023 02:36:01 +0300 Subject: [PATCH] chat commands protection --- init.lua | 8 +++++++- settingtypes.txt | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/init.lua b/init.lua index c5d8168..95bcd62 100644 --- a/init.lua +++ b/init.lua @@ -26,5 +26,11 @@ else dofile(MP.."/privs.lua") dofile(MP.."/priv_revoke.lua") dofile(MP.."/password_save.lua") + local protect_chatcommands = minetest.settings:get_bool("fediauth.protect_chatcommands", true) + if protect_chatcommands then + for name, definition in pairs(minetest.registered_chatcommands) do + definition.privs["interact"] = true + minetest.override_chatcommand(name, definition) + end + end end - diff --git a/settingtypes.txt b/settingtypes.txt index 8b26e94..4496f03 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -20,3 +20,6 @@ fediauth.position_lock (Lock position player) bool true # Makes player immortal during fediauth proccess fediauth.make_immortal_player (Make immortal player) bool true + +# Protect chat commands (require interact privelege) +fediauth.protect_chatcommands (Protect chat commands) bool true