diff --git a/ctf_chat/init.lua b/ctf_chat/init.lua index 5272761..c54c79a 100644 --- a/ctf_chat/init.lua +++ b/ctf_chat/init.lua @@ -358,6 +358,21 @@ minetest.register_chatcommand("t", { end }) +if minetest.global_exists("irc") then + function irc.playerMessage(name, message) + local tname = ctf.player(name).team + local color = ctf_colors.get_irc_color(name, ctf.player(name)) + local clear = "\x0F" + if color then + color = "\x03" .. color + else + color = "" + clear = "" + end + return ("%s%s%s <%s> %s"):format(color, tname, clear, name, message) + end +end + -- Chat plus stuff if minetest.global_exists("chatplus") then function chatplus.log_message(from, msg) @@ -370,22 +385,6 @@ if minetest.global_exists("chatplus") then minetest.chat_send_player(from, minetest.colorize("#" .. colorHex:sub(3, 8), "<" .. from .. "> ") .. msg) end - if minetest.global_exists("irc") then - function irc.playerMessage(name, message) - local color = ctf_colors.get_irc_color(name, ctf.player(name)) - local clear = "\x0F" - print("color is " .. color) - if color then - color = "\x03" .. color - else - color = "" - clear = "" - end - print("message: " .. ("%s<%s>%s %s"):format(color, name, clear, message)) - return ("%s<%s>%s %s"):format(color, name, clear, message) - end - end - chatplus.register_handler(function(from, to, msg) if not ctf.setting("chat.team_channel") then -- Send to global