Fix UNIQUE constraint failed: auth.name in callback createAuth()

This commit is contained in:
kay27 2022-04-29 02:43:25 +03:00
parent b8b9683d50
commit 69bc5dbb16
2 changed files with 24 additions and 0 deletions

View File

@ -1,3 +1,6 @@
local modpath = minetest.get_modpath(minetest.get_current_modname())
dofile(modpath .. "/ratelimit.lua")
local enable_anticheat = true
local kick_cheaters = false
local kick_threshold = 10

View File

@ -0,0 +1,21 @@
-- by LoneWolfHT
-- https://github.com/minetest/minetest/issues/12220#issuecomment-1108789409
local ratelimit = {}
local after = minetest.after
local LIMIT = 2
local function remove_entry(ip)
ratelimit[ip] = nil
end
minetest.register_on_mods_loaded(function()
table.insert(core.registered_on_prejoinplayers, 1, function(player, ip)
if ratelimit[ip] then
return "You are joining too fast, please try again"
else
ratelimit[ip] = true
after(LIMIT, remove_entry, ip)
end
end)
end)