Compare commits

..

7 Commits

Author SHA1 Message Date
563b8a6c5c Merge remote-tracking branch 'upstream/master' 2023-06-07 22:14:12 +02:00
sangeet79
08bf5f9c52
Fix call to deprecated function warning (#9) 2022-10-13 19:43:12 +02:00
6737210d5d Merge remote-tracking branch 'upstream/master' 2021-07-03 17:36:36 +02:00
SmallJoker
3530fa9277 Add mod.conf to solve warnings 2021-06-30 21:15:19 +02:00
SmallJoker
7f99133a17 Update mod to work with different backends 2021-06-28 17:09:33 +02:00
c2648b829b Fix crash 2021-02-26 16:08:09 +01:00
9c0142f767 Fix deprecated call for minetest settings 2021-02-25 23:26:37 +01:00
3 changed files with 8 additions and 3 deletions

View File

View File

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

1
mod.conf Normal file
View File

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