mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-26 02:57:52 +01:00
Disabled geolocations by default on Sponge
This commit is contained in:
parent
cb9c99108d
commit
2b6564bb32
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user