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

View File

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