mail/onjoin.lua

22 lines
515 B
Lua
Raw Normal View History

2019-09-16 09:06:54 +03:00
minetest.register_on_joinplayer(function(player)
minetest.after(2, function(name)
local messages = mail.getMessages(name)
local unreadcount = 0
for _, message in pairs(messages) do
if message.unread then
unreadcount = unreadcount + 1
end
end
if unreadcount > 0 then
minetest.chat_send_player(name,
2021-03-16 19:13:43 +03:00
minetest.colorize("#00f529", "(" .. unreadcount .. ") You have mail! Type /mail to read"))
2019-09-16 09:06:54 +03:00
end
end, player:get_player_name())
mail.migrate_contacts(player:get_player_name())
2019-09-16 09:06:54 +03:00
end)