This commit is contained in:
AFCMS 2021-03-08 17:45:25 +01:00
parent 5b5b525d32
commit 9e7ec24c0e
2 changed files with 6 additions and 5 deletions

View File

@ -34,6 +34,7 @@ function mcl_commands.register_command(name, func, def)
error("[mcl_commands] Failed to register command: ["..name.."] command already existing! Use mcl_commands.overide_command() if you want to overide existing command")
end
minetest.register_chatcommand(name, def)
minetest.log("action", "[mcl_commands] ["..name.."] command registered successfully")
return cmd
end
@ -46,6 +47,7 @@ function mcl_commands.overide_command(name, func, def)
minetest.unregister_chatcommand(name)
end
minetest.register_chatcommand(name, def)
minetest.log("action", "[mcl_commands] ["..name.."] command overridden successfully")
return cmd
end
@ -79,6 +81,7 @@ function mcl_commands.build(func)
params = {},
func = def.func,
privs = def.privs or {}
desc = def.desc
}
-- End of param reached: add it to the pattern
@ -226,8 +229,6 @@ function mcl_commands.build(func)
return cmd
end
dofile(modpath.."/kill.lua")
dofile(modpath.."/setblock.lua")
dofile(modpath.."/seed.lua")

View File

@ -104,17 +104,17 @@ function mcl_title.reset(playername)
end
mcl_commands.register_command("title", function(cmd)
cmd:sub(":name:username title :text:json", {
cmd:sub(":name:username title :params:json", {
func = function(name, target, json)
return mcl_title.set(target, "title", json)
end,
})
cmd:sub(":name:username subtitle :text:json", {
cmd:sub(":name:username subtitle :params:json", {
func = function(name, target, json)
return mcl_title.set(target, "subtitle", json)
end,
})
cmd:sub(":name:username actionbar :text:json", {
cmd:sub(":name:username actionbar :params:json", {
func = function(name, target, json)
return mcl_title.set(target, "actionbar", json)
end,