Skip to content

Commit

Permalink
remove geoip resolve on join
Browse files Browse the repository at this point in the history
  • Loading branch information
BuckarooBanzay committed Feb 6, 2020
1 parent d8e4fe2 commit f039d02
Showing 1 changed file with 0 additions and 36 deletions.
36 changes: 0 additions & 36 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,42 +33,6 @@ local function lookup(ip, callback)
end)
end

-- query on join
-- save country and city in player-meta
-- useful for detection of multi-accounts and ban-evasion on certain ISP's
minetest.register_on_joinplayer(function(player)
if not minetest.get_player_ip then
return
end

local name = player:get_player_name()
local ip = minetest.get_player_ip(name)

if not ip then
return
end

lookup(ip, function(data)
local player_ref = minetest.get_player_by_name(name)
if not player_ref then
return
end

local meta = player_ref:get_meta()

if data.Data then
if data.Data.Country and data.Data.Country.Names and data.Data.Country.Names.en then
meta:set_string("geo_country", data.Data.Country.Names.en)
end
if data.Data.City and data.Data.City.Names and data.Data.City.Names.en then
meta:set_string("geo_city", data.Data.City.Names.en)
end
end
end)

end)



-- manual query
minetest.register_chatcommand("geoip", {
Expand Down

0 comments on commit f039d02

Please sign in to comment.