iPAVGeoGrabber

iPAV Geo-Grabber

An add-on for iPAV v2.6 and higher that allows it to gather address locations off of the web

What It Does

The goal of this add-on plugin is to gather the city, state, and country of a player's IP address when iPAV requests it. It does this by downloading the HTML data of up to 4 specific sources. The following four websites have been selected as sources for the geo location data:

REMEMBER: iPAVGeoGrabber will download a webpage from one or all of these sites when it attempts to get a player's location data!
If you do not trust any of these sites for any reason, DO NOT USE THIS PLUGIN!

How It Does It

When a user logs in, iPAV will first try to detect if iPAVGeoGrabber is loaded on the minecraft server. If it is, it will interact with iPAVGeoGrabber's API which will schedule an asynchronous BukkitTask. This makes the following things that happen run separately to the main server thread instead of being part of the main thread. That way there isn't any lag (even though it would likely be minor) when the HTML page is being downloaded. Now that any possible lag from connecting to the source websites has been avoided, iPAVGeoGrabber will make a connection with one of the four websites listed above. A 5 second timeout is given to the connection so that the async task doesn't spend long trying to get the data. When it does successfully connect, iPAVGeoGrabber will start to read each line of the webpage while doing tests to see if the city, state, or country is contained on that line. If it is, the piece of data is taken from the line and the iPAVGeoGrabber continues looking for the rest of the data. Once it finds the three pieces of information (or if it gets to the end of the webpage), it will close the connection stream. If it hasn't found any data (or if the current website timed out), the next website in the list is checked for the data we want. If it did find any of the data we want, iPAVGeoGrabber will inform iPAV that it finished searching for the geo location and that iPAV can now display that data to the server administrators.

For a more detailed explanation of what iPAVGeoGrabber is doing, there's nothing better than seeing the actual source code. You can view it through the links posted below.

Source Code

iPAVGeoGrabber.java
<sub>Paste-Version of iPAVGeoGrabber.java for better legibility</sub>

GeoData.java
<sub>Paste-Version of GeoData.java for better legibility</sub>

DataSource.java
<sub>Paste-Version of DataSource.java for better legibility</sub>

plugin.yml

Note: If you wish to compile these source files yourself, you must include iPAV v2.6 as an external jar reference in addition to the standard Bukkit reference required for Bukkit plugins.


Comments

Posts Quoted:
Reply
Clear All Quotes

About This Project

  • Project ID
    89663
  • Created
    Feb 19, 2015
  • Last Released File
    Feb 19, 2015
  • Total Downloads
    707
  • License

Categories

Members

Recent Files