Compare commits

..

No commits in common. "master" and "nalc-1.2.0" have entirely different histories.

3 changed files with 3 additions and 8 deletions

0
depends.txt Normal file
View File

View File

@ -14,7 +14,7 @@ ipnames.file = minetest.get_worldpath().."/ipnames.data"
ipnames.whitelist_file = minetest.get_worldpath().."/ipnames_whitelist.data" ipnames.whitelist_file = minetest.get_worldpath().."/ipnames_whitelist.data"
-- Limit 2 = maximal 2 accounts, the 3rd under the same IP gets blocked -- Limit 2 = maximal 2 accounts, the 3rd under the same IP gets blocked
ipnames.name_per_ip_limit = tonumber(minetest.settings:get("max_names_per_ip")) or 2 ipnames.name_per_ip_limit = tonumber(minetest.setting_get("max_names_per_ip")) or 2
-- 2 + 3 = 5 accounts as limit for "ignored" players -- 2 + 3 = 5 accounts as limit for "ignored" players
ipnames.extended_limit = 3 ipnames.extended_limit = 3
@ -70,7 +70,6 @@ minetest.register_on_prejoinplayer(function(name, ip)
names[#names + 1] = k names[#names + 1] = k
end end
end end
-- Return error message if too many accounts have been created -- Return error message if too many accounts have been created
if #names > ipnames.name_per_ip_limit + (count_bonus or 0) then if #names > ipnames.name_per_ip_limit + (count_bonus or 0) then
return "\nYou exceeded the limit of accounts.\n" .. return "\nYou exceeded the limit of accounts.\n" ..
@ -105,19 +104,16 @@ minetest.register_on_joinplayer(function(player)
update_player_address(player:get_player_name()) update_player_address(player:get_player_name())
end) end)
-- Data saving routine
-- Save changes at a fixed interval -- Save changes at a fixed interval
local function save_data_job() local function save_data_job()
ipnames.save_data() ipnames.save_data()
minetest.after(ipnames.save_interval, save_data_job) minetest.after(ipnames.save_interval, save_data_job)
end end
minetest.after(ipnames.save_interval, save_data_job) minetest.after(ipnames.save_interval, save_data_job)
minetest.register_on_shutdown(ipnames.save_data) minetest.register_on_shutdown(ipnames.save_data)
-- Due to use of minetest.player_exists, the data loading must be delayed ipnames.load_data()
-- until ServerEnvironment is set up. register_on_mods_loaded is still too early.
minetest.after(0, ipnames.load_data)
ipnames.load_whitelist() ipnames.load_whitelist()
minetest.log("action", "[names_per_ip] loaded.") minetest.log("action", "[names_per_ip] loaded.")

View File

@ -1 +0,0 @@
name = names_per_ip