diff --git a/mods/CORE/mcl_commands/api.lua b/mods/CORE/mcl_commands/api.lua index 287c6d5fdc..bc8884962c 100644 --- a/mods/CORE/mcl_commands/api.lua +++ b/mods/CORE/mcl_commands/api.lua @@ -52,6 +52,14 @@ mcl_commands.types = { return S("Word is invalid!") end end}, + quotestring = {[["([^ ]+)"]], + function(res, pointer) + if res[pointer] == tostring(res[pointer]) then + return nil, string.sub(tostring(res[pointer]), 2, #res[pointer]-1), pointer+1 + else + return S("String is invalid!") + end + end}, alpha = {"([A-Za-z]+)}", function(res, pointer) if res[pointer] then diff --git a/mods/MISC/mcl_basic_commands/bossbar.lua b/mods/MISC/mcl_basic_commands/bossbar.lua index 2425e0c428..dadd018474 100644 --- a/mods/MISC/mcl_basic_commands/bossbar.lua +++ b/mods/MISC/mcl_basic_commands/bossbar.lua @@ -1,17 +1,24 @@ local S = minetest.get_translator("mcl_commands") +mcl_commands.bossbar = {} +mcl_commands.bossbar.dynamic_bosbars = {} + --1.13 feature --TODO: toggle it with setting/mod mcl_commands.register_command("bossbar", { func = function(cmd) - cmd:sub("add", { - func = function(name) - return + cmd:sub("add :id: :string:word", { + func = function(name, id, string) + mcl_commands.bossbar.dynamic_bosbars[id] = {text=string, color="white", percentage=100} + return true, "Super" end, }) - cmd:sub("set", { - func = function(name, target) - return + cmd:sub("set :id: players :value:word", { + func = function(name, id, value) + mcl_commands.bossbar.dynamic_bosbars[id].players = value + local def = mcl_commands.bossbar.dynamic_bosbars[id] + mcl_bossbars.update_bar(minetest.get_player_by_name(name), def.text, def.color, def.percentage) + return true end, }) cmd:sub("remove", {