IP lookup - ThatzRemix/ChatPlugin Wiki

ChatPlugin includes an IP lookup module which is based on MaxMind's GeoLite2 services. If you are using a multiple server setup (with BungeeCord) you have to enable it only in the proxy; requests from Spigot instances under the network will be handled by the BungeeCord server.

To enable the module, follow these steps:

Lookup method

There are two types of IP lookup request methods: REMOTE and LOCAL. The first requests the lookup from MaxMind's GeoLite2 online web services which provide an easy way to get always updated information with just a HTTP(S) request. The second one, instead, makes use of a local database downloaded from MaxMind's website so that requests are handled locally. They both have pros and cons, here's a table that compares them:

- Remote Local
Average response time 300-400ms 0ms
Max requests per day 1000 unlimited
Max requests per second 2/3 ~500
Anti ban evading system not supported supported
Memory usage N/A very low
Disk usage 0 MB ~70 MB
Data age* real time depends

As you can see a local setup works better in most cases, but if you don't need extremely fast response times it's okay to use the remote one. Just make sure your server doesn't request more than 1000 lookups per day: in that case errors would occur and the plugin would crash. If you want more than 1k requests per day with the remote mode you can also consider upgrading your MaxMind account to a paid plan.

* Data is gathered in real time when using the remote method, while local databases need to be updated to ensure data is always up to date: they are updated automatically every Monday as soon as the server is restarted.

When using the local mode you can change the databases' folder and file names by editing the ip-lookup.database section in config.yml.

Caching

Every IP lookup is cached for a short time to improve performance. You can change the duration at ip-lookup.cache-time in config.yml. Cache cannot be disabled entirely on a BungeeCord setup, but you can set it to very low values (like 5 seconds), although it is not recommended; values from 5 to 15 minutes should be perfect. Note that this option is different for each server, so every Spigot instance under the network uses its own value set in its config.yml. Usually values on Spigot servers should be higher than the one set in the proxy.

Note that online players' IP lookups are kept loaded until they leave the server.

Load on join option

ChatPlugin can be configured to lookup a player's IP when (s)he joins the server. The request is done using an async method so it will not freeze everything during the join event, even if you use the slow remote lookup method. Enabling this will grant zero latency when you open the Playerinfo GUI and when you use the /iplookup <player> command.

Warning: this option will make a request every time a player joins your server. Thus, you have to make sure you will not exceed the 1000 requests per day if you are using the remote lookup method. Otherwise, errors will occur and the plugin will crash.