-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathgeoip_asn_kick.lua
28 lines (25 loc) · 1.04 KB
/
geoip_asn_kick.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
-- kicks a player if he joins from a blacklisted ASN (mostly vpn's)
local has_beerchat = minetest.get_modpath("beerchat")
local blacklisted_asn = {
-- "map-attack" hacks over various ip's
[49453] = true
}
assert(type(geoip.register_on_joinplayer) == "function", "geoip-mod is out of date ('register_on_joinplayer' mmissing)")
geoip.register_on_joinplayer(function(name, result)
if result.asn then
if blacklisted_asn[result.asn] then
-- blacklisted, kick player
local msg = "Player '" .. name .. "' joined from a blacklisted ASN: '" .. result.asn .. "'"
minetest.log("action", "[beowulf] " .. msg)
if has_beerchat then
beerchat.send_on_channel("Geoip-ASN-Kick", beerchat.moderator_channel_name, msg)
end
if minetest.settings:get_bool("beowulf.geoip_asn_kick.enable", false) then
minetest.after(0, function()
minetest.kick_player(name, "you are joining from a blacklisted network that is known for troublemakers, " ..
"if you think this is a mistake please report this on irc/discord")
end)
end
end
end
end)