mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2025-01-11 18:40:25 +01:00
remove tick function, save on join_player
This commit is contained in:
parent
62902e8ff6
commit
bd5ffcf50d
@ -8,8 +8,6 @@ ipnames = {}
|
|||||||
ipnames.data = {}
|
ipnames.data = {}
|
||||||
ipnames.tmp_data = {}
|
ipnames.tmp_data = {}
|
||||||
ipnames.changes = false
|
ipnames.changes = false
|
||||||
ipnames.save_interval = 120
|
|
||||||
ipnames.save_time = 0
|
|
||||||
ipnames.file = minetest.get_worldpath().."/ipnames.txt"
|
ipnames.file = minetest.get_worldpath().."/ipnames.txt"
|
||||||
|
|
||||||
ipnames.name_per_ip_limit = tonumber(minetest.setting_get("max_names_per_ip")) or 5
|
ipnames.name_per_ip_limit = tonumber(minetest.setting_get("max_names_per_ip")) or 5
|
||||||
@ -73,6 +71,7 @@ minetest.register_on_joinplayer(function(player)
|
|||||||
ipnames.data[name] = ipnames.tmp_data[name]
|
ipnames.data[name] = ipnames.tmp_data[name]
|
||||||
ipnames.tmp_data[name] = nil
|
ipnames.tmp_data[name] = nil
|
||||||
ipnames.changes = true
|
ipnames.changes = true
|
||||||
|
ipnames.save_data()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
function ipnames.load_data()
|
function ipnames.load_data()
|
||||||
@ -105,12 +104,6 @@ function ipnames.save_data()
|
|||||||
io.close(file)
|
io.close(file)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function tick()
|
|
||||||
minetest.after(ipnames.save_interval, tick)
|
|
||||||
ipnames.save_data()
|
|
||||||
end
|
|
||||||
|
|
||||||
tick()
|
|
||||||
|
|
||||||
minetest.register_on_shutdown(function() ipnames.save_data() end)
|
minetest.register_on_shutdown(function() ipnames.save_data() end)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user