2023-05-05 17:05:07 +03:00
|
|
|
-- translation
|
2024-09-01 17:13:13 +03:00
|
|
|
local S = mail.S
|
2023-05-05 17:05:07 +03:00
|
|
|
|
2019-09-16 09:06:54 +03:00
|
|
|
minetest.register_on_joinplayer(function(player)
|
|
|
|
minetest.after(2, function(name)
|
2023-03-29 18:25:01 +03:00
|
|
|
local entry = mail.get_storage_entry(name)
|
|
|
|
local messages = entry.inbox
|
2023-04-01 20:14:53 +03:00
|
|
|
mail.hud_update(name, messages)
|
2019-09-16 09:06:54 +03:00
|
|
|
|
|
|
|
local unreadcount = 0
|
|
|
|
|
|
|
|
for _, message in pairs(messages) do
|
2023-04-01 20:14:53 +03:00
|
|
|
if not message.read then
|
2019-09-16 09:06:54 +03:00
|
|
|
unreadcount = unreadcount + 1
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-05-05 12:38:19 +03:00
|
|
|
if unreadcount > 0 and mail.get_setting(name, "onjoin_notifications") then
|
2019-09-16 09:06:54 +03:00
|
|
|
minetest.chat_send_player(name,
|
2023-12-06 12:11:12 +03:00
|
|
|
minetest.colorize(mail.get_color("new"), "(" .. unreadcount .. ") " .. S("You have mail! Type /mail to read")))
|
2019-09-16 09:06:54 +03:00
|
|
|
end
|
|
|
|
end, player:get_player_name())
|
|
|
|
end)
|