diff --git a/Plan/src/main/java/com/djrapitops/plan/system/cache/GeolocationCache.java b/Plan/src/main/java/com/djrapitops/plan/system/cache/GeolocationCache.java index 353083fac..d0825e32d 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/cache/GeolocationCache.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/cache/GeolocationCache.java @@ -3,6 +3,8 @@ package com.djrapitops.plan.system.cache; import com.djrapitops.plan.api.exceptions.EnableException; import com.djrapitops.plan.system.SubSystem; import com.djrapitops.plan.system.file.FileSystem; +import com.djrapitops.plan.system.settings.Settings; +import com.djrapitops.plugin.api.Check; import com.djrapitops.plugin.api.utility.log.Log; import com.djrapitops.plugin.utilities.Verify; import com.google.common.cache.Cache; @@ -45,12 +47,14 @@ public class GeolocationCache implements SubSystem { @Override public void enable() throws EnableException { geolocationDB = new File(FileSystem.getDataFolder(), "GeoIP.dat"); - try { - GeolocationCache.checkDB(); - } catch (UnknownHostException e) { - Log.error("Plan Requires internet access on first run to download GeoLite2 Geolocation database."); - } catch (IOException e) { - throw new EnableException("Something went wrong saving the downloaded GeoLite2 Geolocation database", e); + if (!Check.isSpongeAvailable() || Settings.DATA_GEOLOCATIONS.isTrue()) { + try { + GeolocationCache.checkDB(); + } catch (UnknownHostException e) { + Log.error("Plan Requires internet access on first run to download GeoLite2 Geolocation database."); + } catch (IOException e) { + throw new EnableException("Something went wrong saving the downloaded GeoLite2 Geolocation database", e); + } } } diff --git a/Plan/src/main/java/com/djrapitops/plan/system/processing/processors/player/IPUpdateProcessor.java b/Plan/src/main/java/com/djrapitops/plan/system/processing/processors/player/IPUpdateProcessor.java index 759695e73..420c03243 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/processing/processors/player/IPUpdateProcessor.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/processing/processors/player/IPUpdateProcessor.java @@ -9,6 +9,8 @@ import com.djrapitops.plan.data.container.GeoInfo; import com.djrapitops.plan.system.cache.GeolocationCache; import com.djrapitops.plan.system.database.databases.Database; import com.djrapitops.plan.system.processing.CriticalRunnable; +import com.djrapitops.plan.system.settings.Settings; +import com.djrapitops.plugin.api.Check; import com.djrapitops.plugin.api.utility.log.Log; import java.util.UUID; @@ -32,11 +34,13 @@ public class IPUpdateProcessor implements CriticalRunnable { @Override public void run() { - String country = GeolocationCache.getCountry(ip); - try { - Database.getActive().save().geoInfo(uuid, new GeoInfo(ip, country, time)); - } catch (DBException e) { - Log.toLog(this.getClass(), e); + if (!Check.isSpongeAvailable() || Settings.DATA_GEOLOCATIONS.isTrue()) { + String country = GeolocationCache.getCountry(ip); + try { + Database.getActive().save().geoInfo(uuid, new GeoInfo(ip, country, time)); + } catch (DBException e) { + Log.toLog(this.getClass(), e); + } } } } \ No newline at end of file