Class GeolocationCache
java.lang.Object
com.djrapitops.plan.gathering.geolocation.GeolocationCache
- All Implemented Interfaces:
SubSystem
This class contains the geolocation cache.
It caches all IPs with their matching country.
-
Constructor Summary
ConstructorDescriptionGeolocationCache
(Locale locale, PlanConfig config, GeoLite2Geolocator geoLite2Geolocator, net.playeranalytics.plugin.server.PluginLogger logger, Processing processing) -
Method Summary
Modifier and TypeMethodDescriptionboolean
void
Clears the cachevoid
disable()
Performs disable actions for the subsystemvoid
enable()
Performs enable actions for the subsystem.getCountry
(String ipAddress) Retrieves the country in full length (e.g.void
-
Constructor Details
-
GeolocationCache
@Inject public GeolocationCache(Locale locale, PlanConfig config, GeoLite2Geolocator geoLite2Geolocator, net.playeranalytics.plugin.server.PluginLogger logger, Processing processing)
-
-
Method Details
-
enable
public void enable()Description copied from interface:SubSystem
Performs enable actions for the subsystem. -
canGeolocate
public boolean canGeolocate() -
tryToPrepareGeoLite2
public void tryToPrepareGeoLite2() -
getCountry
Retrieves the country in full length (e.g. United States) from the IP Address.- Parameters:
ipAddress
- The IP Address for which the country is retrieved- Returns:
- The name of the country in full length or null if the country could not be fetched.
-
disable
public void disable()Description copied from interface:SubSystem
Performs disable actions for the subsystem -
clearCache
public void clearCache()Clears the cache
-