Initial commit

master
VanessaE 2020-05-06 05:34:39 -04:00
commit a4e8d5dfad
2 changed files with 27 additions and 0 deletions

1
depends.txt Normal file
View File

@ -0,0 +1 @@
notice

26
init.lua Normal file
View File

@ -0,0 +1,26 @@
-- Simple reboot warning mod
local ie = minetest.request_insecure_environment()
local timer = 0
local warning_file = minetest.get_worldpath().."/reboot_warning"
minetest.register_globalstep(function(dtime)
if timer > 600 then -- 600 tenths = 1 minute
timer = 0
local f = io.open(warning_file, "r")
if f then
io.close(f)
ie.os.remove(warning_file)
for _, player in ipairs(minetest.get_connected_players()) do
local playername = player:get_player_name()
if playername then
notice.send(playername,
"*** IMPORTANT NOTICE: | The server will be | rebooting for its nightly | backup in a few minutes!")
minetest.log("Issued reboot warning to "..playername)
end
end
end
end
timer = timer + 1
end)