HomeJavaMods[API] GeoIP
[API] GeoIP
geolocation-300x207.png Geoip API
Please dont report issues in the review, and dont report issues if you are not sure its a problem of the api.

What does it?

With this api you can get the location of an ip/player, it uses GeoLite data created by MaxMind http://www.maxmind.com. The api will automatically download the database from the maxmind mirror!

LocalIP
Its not working with an localip like 127.0.0.1 this is because it cant get your external ip.

Its returns null?
If the api return null this is most of the times because your ip is not in the geoip database. Thats why you always need to check if the output is not null!

How to use?

Code (Text):

//Get the ip from a player
InetAddress ip = player.getAddress().getAddress();

//Check if the ip is not null
if(ip == null){
   return;
}
 
//Check if the ip is not local  
if(ip.isAnyLocalAddress() || ip.isLoopbackAddress()){
   return;
}

//get the country, city & timezone of the user
GeoIP geo = new GeoIP(ip);
geo.countryName;
geo.city;
// etc
 

Plugin.yml
add this to your plugin.yml
Code (YAML):
depend : [GeoipAPI ]


Links
Quick facts

Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.

[API] GeoIP is a free Minecraft Java mod. Compatible with Minecraft 1.8, 1.9, 1.10, 1.11 and newer. Downloaded 8,793 times (via Spigot). Download it and open it directly in the game.

Explore more