From 10441637176783f59d9a5411d6428d61f5353611 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Mon, 27 Nov 2023 02:22:39 +0000 Subject: [PATCH] Fixed the ambiguous /clear command being dangerous (#4026) Implements #3826 Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/4026 Co-authored-by: the-real-herowl Co-committed-by: the-real-herowl --- mods/MISC/mcl_commands/alias.lua | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/mods/MISC/mcl_commands/alias.lua b/mods/MISC/mcl_commands/alias.lua index 5c9ee9f3c..2c700408b 100644 --- a/mods/MISC/mcl_commands/alias.lua +++ b/mods/MISC/mcl_commands/alias.lua @@ -18,7 +18,7 @@ if minetest.settings:get_bool("mcl_builtin_commands_overide", true) then register_chatcommand_alias("tell", "msg") register_chatcommand_alias("w", "msg") register_chatcommand_alias("tp", "teleport") - rename_chatcommand("clear", "clearinv") + register_chatcommand_alias("clearinventory", "clearinv") minetest.register_chatcommand("banlist", { description = S("List bans"), @@ -27,4 +27,14 @@ if minetest.settings:get_bool("mcl_builtin_commands_overide", true) then return true, S("Ban list: @1", minetest.get_ban_list()) end, }) -end \ No newline at end of file + + minetest.register_chatcommand("clear", { + description = S("List clear commands"), + func = function(name) + return true, S("To clear inventory use /clearinv or /clearinventory").."\n".. + S("To clear mobs use /clearmobs").."\n".. + S("To clear the weather use /weather clear").."\n".. + S("Clearing the chat is not possible, you can hide the chat using \"Toggle chat log\" key (default F2) on PC or the chat icon on the mobile version") + end, + }) +end