From 5b5b525d32e3f48e72310863ae42073312fbc098 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Mon, 8 Mar 2021 17:05:17 +0100 Subject: [PATCH] fix title command --- mods/MISC/mcl_commands/init.lua | 2 +- mods/MISC/mcl_commands/title.lua | 34 ++++++++++++++++++++------------ 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/mods/MISC/mcl_commands/init.lua b/mods/MISC/mcl_commands/init.lua index 223fcdd91..7bf1b8cf0 100644 --- a/mods/MISC/mcl_commands/init.lua +++ b/mods/MISC/mcl_commands/init.lua @@ -235,6 +235,6 @@ dofile(modpath.."/summon.lua") dofile(modpath.."/say.lua") dofile(modpath.."/list.lua") dofile(modpath.."/sound.lua") ---dofile(modpath.."/title.lua") +dofile(modpath.."/title.lua") dofile(modpath.."/alias.lua") \ No newline at end of file diff --git a/mods/MISC/mcl_commands/title.lua b/mods/MISC/mcl_commands/title.lua index 135cff2bc..273568b8d 100644 --- a/mods/MISC/mcl_commands/title.lua +++ b/mods/MISC/mcl_commands/title.lua @@ -104,22 +104,30 @@ function mcl_title.reset(playername) end mcl_commands.register_command("title", function(cmd) - cmd:sub(":name:username title :text:json", function(name, target, json) - return mcl_title.set(target, "title", json) - end) - cmd:sub(":name:username subtitle :text:json", function(name, target, json) - return mcl_title.set(target, "subtitle", json) - end) - cmd:sub(":name:username actionbar :text:json", function(name, target, json) - return mcl_title.set(target, "actionbar", json) - end) - cmd:sub(":name:username times :fadeIn:int :stay:int :fadeOut:int", function(name, target, fadeIn, stay, fadeOut) --WIP - return mcl_title.times(target, fadeIn, stay, fadeOut) - end) + cmd:sub(":name:username title :text:json", { + func = function(name, target, json) + return mcl_title.set(target, "title", json) + end, + }) + cmd:sub(":name:username subtitle :text:json", { + func = function(name, target, json) + return mcl_title.set(target, "subtitle", json) + end, + }) + cmd:sub(":name:username actionbar :text:json", { + func = function(name, target, json) + return mcl_title.set(target, "actionbar", json) + end, + }) + cmd:sub(":name:username times :fadeIn:int :stay:int :fadeOut:int", { + func = function(name, target, fadeIn, stay, fadeOut) --WIP + return mcl_title.times(target, fadeIn, stay, fadeOut) + end, + }) cmd:sub(":name:username clear", { func = function(name, target) return mcl_title.clear(target) - end + end, }) cmd:sub(":name:username reset", { func = function(name, target)