mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-23 00:21:43 +01:00
Removed guava as a dependency
This commit is contained in:
parent
20df1264ad
commit
f0e1b7521d
@ -14,7 +14,6 @@ dependencies {
|
||||
compile "org.slf4j:slf4j-api:$slf4jVersion"
|
||||
compile "com.maxmind.geoip2:geoip2:$geoIpVersion"
|
||||
compile "com.google.code.gson:gson:$gsonVersion"
|
||||
compileOnly "com.google.guava:guava:$guavaVersion"
|
||||
|
||||
testCompile project(":api")
|
||||
testCompile "com.google.code.gson:gson:$gsonVersion"
|
||||
|
@ -18,11 +18,11 @@ package com.djrapitops.plan.data.container;
|
||||
|
||||
import com.djrapitops.plan.data.store.objects.DateHolder;
|
||||
import com.djrapitops.plan.data.store.objects.DateMap;
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.net.Inet6Address;
|
||||
import java.net.InetAddress;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Data class that contains information about IP and Geolocation.
|
||||
@ -107,13 +107,13 @@ public class GeoInfo implements DateHolder, Serializable {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
GeoInfo geoInfo = (GeoInfo) o;
|
||||
return Objects.equal(ip, geoInfo.ip) &&
|
||||
Objects.equal(geolocation, geoInfo.geolocation);
|
||||
return Objects.equals(ip, geoInfo.ip) &&
|
||||
Objects.equals(geolocation, geoInfo.geolocation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(ip, geolocation);
|
||||
return Objects.hash(ip, geolocation);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -21,9 +21,9 @@ import com.djrapitops.plan.data.element.InspectContainer;
|
||||
import com.djrapitops.plan.utilities.html.Html;
|
||||
import com.djrapitops.plan.utilities.html.icon.Color;
|
||||
import com.djrapitops.plan.utilities.html.icon.Icon;
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
@ -98,18 +98,18 @@ public abstract class PluginData {
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean equals(Object o) {
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
PluginData that = (PluginData) o;
|
||||
return size == that.size &&
|
||||
Objects.equal(sourcePlugin, that.sourcePlugin) &&
|
||||
Objects.equal(pluginIcon, that.pluginIcon);
|
||||
Objects.equals(sourcePlugin, that.sourcePlugin) &&
|
||||
Objects.equals(pluginIcon, that.pluginIcon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int hashCode() {
|
||||
return Objects.hashCode(size, sourcePlugin, pluginIcon);
|
||||
public int hashCode() {
|
||||
return Objects.hash(size, sourcePlugin, pluginIcon);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -18,9 +18,9 @@ package com.djrapitops.plan.data.store.mutators;
|
||||
|
||||
import com.djrapitops.plan.data.store.containers.PlayerContainer;
|
||||
import com.djrapitops.plan.data.store.keys.PlayerKeys;
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@ -91,12 +91,12 @@ public class RetentionData {
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
RetentionData that = (RetentionData) o;
|
||||
return Double.compare(that.activityIndex, activityIndex) == 0 &&
|
||||
Objects.equal(onlineOnJoin, that.onlineOnJoin);
|
||||
Double.compare(that.onlineOnJoin, onlineOnJoin) == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(activityIndex, onlineOnJoin);
|
||||
return Objects.hash(activityIndex, onlineOnJoin);
|
||||
}
|
||||
|
||||
public double getOnlineOnJoin() {
|
||||
|
@ -38,7 +38,7 @@ import com.djrapitops.plugin.logging.console.PluginLogger;
|
||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||
import com.djrapitops.plugin.task.AbsRunnable;
|
||||
import com.djrapitops.plugin.task.RunnableFactory;
|
||||
import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||
import org.apache.commons.lang3.concurrent.BasicThreadFactory;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
@ -89,7 +89,16 @@ public abstract class SQLDB extends AbstractDatabase {
|
||||
|
||||
devMode = config.get(PluginSettings.DEV_MODE);
|
||||
|
||||
this.transactionExecutorServiceProvider = () -> Executors.newSingleThreadExecutor(new ThreadFactoryBuilder().setNameFormat("Plan " + getClass().getSimpleName() + "-transaction-thread-%d").build());
|
||||
this.transactionExecutorServiceProvider = () -> {
|
||||
String nameFormat = "Plan " + getClass().getSimpleName() + "-transaction-thread-%d";
|
||||
return Executors.newSingleThreadExecutor(new BasicThreadFactory.Builder()
|
||||
.namingPattern(nameFormat)
|
||||
.uncaughtExceptionHandler((thread, throwable) -> {
|
||||
if (config.get(PluginSettings.DEV_MODE)) {
|
||||
errorHandler.log(L.WARN, getClass(), throwable);
|
||||
}
|
||||
}).build());
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -21,7 +21,6 @@ import com.djrapitops.plan.data.store.objects.DateObj;
|
||||
import com.djrapitops.plan.db.access.queries.DataStoreQueries;
|
||||
import com.djrapitops.plan.db.access.transactions.Transaction;
|
||||
import com.djrapitops.plan.utilities.analysis.Median;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.OptionalInt;
|
||||
@ -83,7 +82,7 @@ public class PingStoreTransaction extends Transaction {
|
||||
.max();
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
// VisibleForTesting
|
||||
int getMeanValue() {
|
||||
return (int) Median.forList(pingList.stream().map(DateObj::getValue).collect(Collectors.toList())).calculate();
|
||||
}
|
||||
|
@ -37,7 +37,6 @@ import com.djrapitops.plugin.logging.L;
|
||||
import com.djrapitops.plugin.logging.console.PluginLogger;
|
||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||
import com.djrapitops.plugin.task.AbsRunnable;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
@ -110,7 +109,7 @@ public class DBCleanTask extends AbsRunnable {
|
||||
}
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
// VisibleForTesting
|
||||
public int cleanOldPlayers(Database database) {
|
||||
long now = System.currentTimeMillis();
|
||||
long keepActiveAfter = now - config.get(TimeSettings.DELETE_INACTIVE_PLAYERS_AFTER);
|
||||
|
@ -18,7 +18,6 @@ package com.djrapitops.plan.system.cache;
|
||||
|
||||
import com.djrapitops.plan.data.container.Session;
|
||||
import com.djrapitops.plan.data.store.keys.SessionKeys;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
@ -43,7 +42,7 @@ public class SessionCache {
|
||||
}
|
||||
|
||||
public static Map<UUID, Session> getActiveSessions() {
|
||||
return ImmutableMap.copyOf(ACTIVE_SESSIONS);
|
||||
return Collections.unmodifiableMap(ACTIVE_SESSIONS);
|
||||
}
|
||||
|
||||
public static void clear() {
|
||||
|
@ -22,8 +22,8 @@ import com.djrapitops.plan.system.locale.lang.PluginLang;
|
||||
import com.djrapitops.plugin.logging.L;
|
||||
import com.djrapitops.plugin.logging.console.PluginLogger;
|
||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||
import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||
import dagger.Lazy;
|
||||
import org.apache.commons.lang3.concurrent.BasicThreadFactory;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
@ -54,7 +54,12 @@ public class Processing implements SubSystem {
|
||||
}
|
||||
|
||||
protected ExecutorService createExecutor(int i, String s) {
|
||||
return Executors.newFixedThreadPool(i, new ThreadFactoryBuilder().setNameFormat(s).build());
|
||||
return Executors.newFixedThreadPool(i,
|
||||
new BasicThreadFactory.Builder()
|
||||
.namingPattern(s)
|
||||
.uncaughtExceptionHandler((thread, throwable) -> {
|
||||
errorHandler.log(L.WARN, Processing.class, throwable);
|
||||
}).build());
|
||||
}
|
||||
|
||||
public void submit(Runnable runnable) {
|
||||
|
@ -20,7 +20,6 @@ import com.djrapitops.plan.system.settings.config.Config;
|
||||
import com.djrapitops.plugin.logging.L;
|
||||
import com.djrapitops.plugin.logging.console.PluginLogger;
|
||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
@ -52,7 +51,7 @@ public class ConfigUpdater {
|
||||
config.save();
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
// VisibleForTesting
|
||||
ConfigChange[] configEnhancementPatch() {
|
||||
return new ConfigChange[]{
|
||||
new ConfigChange.Moved("Plugin.Locale", "Plugin.Logging.Locale"),
|
||||
|
@ -17,7 +17,8 @@
|
||||
package com.djrapitops.plan.system.update;
|
||||
|
||||
import com.djrapitops.plugin.api.utility.Version;
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Data class for reading version.txt in https://github.com/Rsl1122/Plan-PlayerAnalytics.
|
||||
@ -64,12 +65,12 @@ public class VersionInfo implements Comparable<VersionInfo> {
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
VersionInfo that = (VersionInfo) o;
|
||||
return release == that.release &&
|
||||
Objects.equal(version, that.version);
|
||||
Objects.equals(version, that.version);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(release, version);
|
||||
return Objects.hash(release, version);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -24,16 +24,17 @@ import com.djrapitops.plan.system.info.server.properties.ServerProperties;
|
||||
import com.djrapitops.plan.system.locale.Locale;
|
||||
import com.djrapitops.plan.system.locale.lang.PluginLang;
|
||||
import com.djrapitops.plan.system.settings.config.PlanConfig;
|
||||
import com.djrapitops.plan.system.settings.paths.PluginSettings;
|
||||
import com.djrapitops.plan.system.settings.paths.WebserverSettings;
|
||||
import com.djrapitops.plugin.api.Check;
|
||||
import com.djrapitops.plugin.logging.L;
|
||||
import com.djrapitops.plugin.logging.console.PluginLogger;
|
||||
import com.djrapitops.plugin.logging.error.ErrorHandler;
|
||||
import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||
import com.sun.net.httpserver.HttpServer;
|
||||
import com.sun.net.httpserver.HttpsConfigurator;
|
||||
import com.sun.net.httpserver.HttpsParameters;
|
||||
import com.sun.net.httpserver.HttpsServer;
|
||||
import org.apache.commons.lang3.concurrent.BasicThreadFactory;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
@ -143,7 +144,13 @@ public class WebServer implements SubSystem {
|
||||
|
||||
ExecutorService executor = new ThreadPoolExecutor(
|
||||
4, 8, 30, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100),
|
||||
new ThreadFactoryBuilder().setNameFormat("Plan WebServer Thread-%d").build()
|
||||
new BasicThreadFactory.Builder()
|
||||
.namingPattern("Plan WebServer Thread-%d")
|
||||
.uncaughtExceptionHandler((thread, throwable) -> {
|
||||
if (config.get(PluginSettings.DEV_MODE)) {
|
||||
errorHandler.log(L.WARN, WebServer.class, throwable);
|
||||
}
|
||||
}).build()
|
||||
);
|
||||
server.setExecutor(executor);
|
||||
server.start();
|
||||
|
Loading…
Reference in New Issue
Block a user