From 155548f384c581dff7feae1bd91ee0edabc2592c Mon Sep 17 00:00:00 2001 From: AFCMS Date: Mon, 8 Mar 2021 20:34:36 +0100 Subject: [PATCH] refactor chat message then you haven't the required privs --- mods/MISC/mcl_commands/init.lua | 12 ++++++------ mods/MISC/mcl_commands/title.lua | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/mods/MISC/mcl_commands/init.lua b/mods/MISC/mcl_commands/init.lua index 6ce426c78..3ce26a0ec 100644 --- a/mods/MISC/mcl_commands/init.lua +++ b/mods/MISC/mcl_commands/init.lua @@ -216,7 +216,11 @@ function mcl_commands.build(func, def) return sub.func(unpack(params)) end else - return false, "You don't have permission to run this command (missing privilege: "..minetest.serialize(missing_privs)..")" --TODO:replace message + local missing_privs_str = "" + for i = 1, #missing_privs do + missing_privs_str = missing_privs_str..missing_privs[i].." " + end + return false, "You don't have permission to run this command (missing privilege: "..missing_privs_str..")" --TODO:replace message end end end @@ -225,11 +229,7 @@ function mcl_commands.build(func, def) if not def.params then def.params = "" end - local params_help = "" - for i = 1, #cmd._subs do - params_help = params_help..def.params.." "..cmd._subs[i].params_desc.." " - end - cmd.params = params_help + cmd.params = def.params cmd.privs = def.privs cmd.description = def.description return cmd diff --git a/mods/MISC/mcl_commands/title.lua b/mods/MISC/mcl_commands/title.lua index 082038cc7..30e562c1f 100644 --- a/mods/MISC/mcl_commands/title.lua +++ b/mods/MISC/mcl_commands/title.lua @@ -108,7 +108,6 @@ mcl_commands.register_command("title", function(cmd) func = function(name, target, json) return mcl_title.set(target, "title", json) end, - params = "", }) cmd:sub(":name:username subtitle :params:json", { func = function(name, target, json) @@ -137,6 +136,7 @@ mcl_commands.register_command("title", function(cmd) }) end, { description = "Controls text displayed on the screen.", + params = " command ", privs = { server = true, }