From c1258412c43cd9f1657a96e44d2ad97baa069dda Mon Sep 17 00:00:00 2001 From: cheapie Date: Sat, 13 Mar 2021 02:09:59 -0600 Subject: Hopefully compatible with modern clients again --- init.lua | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/init.lua b/init.lua index 5d1569c..505ba43 100644 --- a/init.lua +++ b/init.lua @@ -1,10 +1,5 @@ chat6 = {} -local player_name = "UNKNOWN" -minetest.register_on_connect(function() - player_name = minetest.localplayer:get_name() -end) - local function default_settings() chat6.settings.fields.highlight_color = "#4E9A06" chat6.settings.fields.send_nick_color = "#A40000" @@ -60,7 +55,6 @@ minetest.register_on_formspec_input(function(formname,fields) chat6.settings.fields.send_message_color = validate_hex_color(fields.sendmsg,chat6.settings.fields.send_message_color) chat6.settings.fields.join_color = validate_hex_color(fields.join,chat6.settings.fields.join_color) chat6.settings.fields.part_color = validate_hex_color(fields.part,chat6.settings.fields.part_color) - --chat6.settings.fields.timestamps = (fields.timestamps and "true" or "false") chat6.storage:from_table(chat6.settings) end return true @@ -102,6 +96,7 @@ minetest.register_on_receiving_chat_message(function(message) timestamp = string.format("[%02d:%02d:%02d] ",date.hour,date.min,date.sec) end if string.sub(message,1,1) == "<" then + local player_name = minetest.localplayer:get_name() msgtype = "channel" user,text = string.match(message,"^<([^%c ]*)> (.*)$") if not user then @@ -118,6 +113,7 @@ minetest.register_on_receiving_chat_message(function(message) text = "(Client Quit)" end elseif string.sub(message,1,1) == "*" then + local player_name = minetest.localplayer:get_name() msgtype = "action" user,text = string.match(message,"^* ([^%c ]*) (.*)$") if not user then -- cgit v1.2.3