From 19e83fc2fb9b3e15e9c3f025613029a9b9fbde53 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Mon, 8 Mar 2021 23:27:39 +0100 Subject: [PATCH] fixes --- mods/MISC/mcl_commands/init.lua | 21 +++++++++++---------- mods/MISC/mcl_commands/kill.lua | 28 +++++++++++++++------------- mods/MISC/mcl_commands/say.lua | 15 --------------- 3 files changed, 26 insertions(+), 38 deletions(-) diff --git a/mods/MISC/mcl_commands/init.lua b/mods/MISC/mcl_commands/init.lua index 2656b8a0d..0a737fff7 100644 --- a/mods/MISC/mcl_commands/init.lua +++ b/mods/MISC/mcl_commands/init.lua @@ -61,7 +61,7 @@ end local dprint = function() end -function mcl_commands.build(def) +function mcl_commands.build(name, chat_def) local cmd = { _subs = {} } @@ -174,8 +174,8 @@ function mcl_commands.build(def) table.insert(self._subs, sub) end - if def.func then - def.func(cmd) + if chat_def.func then + chat_def.func(cmd) end cmd.func = function(name, param) @@ -224,18 +224,19 @@ function mcl_commands.build(def) missing_privs_str = missing_privs_str..missing_privs[i] end end - return false, "You don't have permission to run this command (missing privilege: "..missing_privs_str..")" --TODO:replace message + return false, "You don't have permission to run this command (missing privilege: "..missing_privs_str..")" end end end - return false, "Invalid parameters: " + return false, "Invalid parameters!" end - if not def.params then - def.params = "" + if chat_def.params then + cmd.params = chat_def.params + else + cmd.params = "" end - cmd.params = def.params - cmd.privs = def.privs - cmd.description = def.description + cmd.privs = chat_def.privs + cmd.description = chat_def.description return cmd end diff --git a/mods/MISC/mcl_commands/kill.lua b/mods/MISC/mcl_commands/kill.lua index 3ee70d15d..3d21f11c8 100644 --- a/mods/MISC/mcl_commands/kill.lua +++ b/mods/MISC/mcl_commands/kill.lua @@ -41,19 +41,21 @@ local function handle_kill_command(suspect, victim) return true end -mcl_commands.overide_command("kill", function(cmd) - cmd:sub("", { - func = function(name) - return handle_kill_command(name, name) - end, - }) - cmd:sub(":target:username", { - func = function(name, target) - return handle_kill_command(name, target) - end, - privs = {settime = true} - }) -end, { +mcl_commands.overide_command("kill", { + func = function(cmd) + cmd:sub("", { + func = function(name) + return handle_kill_command(name, name) + end, + }) + cmd:sub(":target:username", { + func = function(name, target) + return handle_kill_command(name, target) + end, + privs = {settime = true} + }) + end, description = "Kill player or yourself.", + params = S("[]"), privs = {server = true}, }) \ No newline at end of file diff --git a/mods/MISC/mcl_commands/say.lua b/mods/MISC/mcl_commands/say.lua index f98f906a0..362ec759e 100644 --- a/mods/MISC/mcl_commands/say.lua +++ b/mods/MISC/mcl_commands/say.lua @@ -5,21 +5,6 @@ minetest.register_privilege("announce", { give_to_singleplayer = false, }) -mcl_commands.register_command("say", function(cmd) - cmd:sub(":message:text", { - func = function(name, message) - minetest.chat_send_all(("["..name.."] "..message)) - return true - end}) - end, - { - description = S("Send a message to every player"), - params = S(""), - privs = { - announce = true, - } -}) - mcl_commands.register_command("say", { func = function(cmd) cmd:sub(":message:text", {