refactor chat message then you haven't the required privs

This commit is contained in:
AFCMS 2021-03-08 20:34:36 +01:00
parent f7b832508f
commit 155548f384
2 changed files with 7 additions and 7 deletions

View File

@ -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

View File

@ -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 = "<json>",
})
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 = "<target> command <params>",
privs = {
server = true,
}