diff --git a/Plan/dependency-reduced-pom.xml b/Plan/dependency-reduced-pom.xml
index 67d6f5663..f5d762d20 100644
--- a/Plan/dependency-reduced-pom.xml
+++ b/Plan/dependency-reduced-pom.xml
@@ -87,6 +87,10 @@
org.slf4j.Logger
+
+ org.bstats
+ com.djrapitops.plan.utilities.metrics
+
@@ -145,6 +149,14 @@
sponge-repohttps://repo.spongepowered.org/maven
+
+ md_5-snapshots
+ http://repo.md-5.net/content/repositories/snapshots/
+
+
+ bstats-repo
+ http://repo.bstats.org/content/repositories/releases/
+
@@ -347,6 +359,12 @@
+
+ com.imaginarycode.minecraft
+ RedisBungee
+ 0.3.8-SNAPSHOT
+ provided
+ org.mockitomockito-core
@@ -370,7 +388,7 @@
org.xerialsqlite-jdbc
- 3.21.0.1
+ 3.23.1test
diff --git a/Plan/pom.xml b/Plan/pom.xml
index ef6bcd10b..0c307b7e6 100644
--- a/Plan/pom.xml
+++ b/Plan/pom.xml
@@ -24,6 +24,16 @@
sponge-repohttps://repo.spongepowered.org/maven
+
+
+ md_5-snapshots
+ http://repo.md-5.net/content/repositories/snapshots/
+
+
+
+ bstats-repo
+ http://repo.bstats.org/content/repositories/releases/
+
@@ -77,6 +87,14 @@
jarprovided
+
+
+ com.imaginarycode.minecraft
+ RedisBungee
+ 0.3.8-SNAPSHOT
+ jar
+ provided
+
@@ -104,6 +122,23 @@
2.9.0
+
+
+ org.bstats
+ bstats-bukkit
+ 1.2
+
+
+ org.bstats
+ bstats-bungeecord
+ 1.2
+
+
+ org.bstats
+ bstats-sponge
+ 1.2
+
+
org.mockito
@@ -116,7 +151,7 @@
org.xerialsqlite-jdbc
- 3.21.0.1
+ 3.23.1test
@@ -217,6 +252,10 @@
org.slf4j.Logger
+
+ org.bstats
+ com.djrapitops.plan.utilities.metrics
+
diff --git a/Plan/src/main/java/com/djrapitops/plan/Plan.java b/Plan/src/main/java/com/djrapitops/plan/Plan.java
index f1619c650..13418bb04 100644
--- a/Plan/src/main/java/com/djrapitops/plan/Plan.java
+++ b/Plan/src/main/java/com/djrapitops/plan/Plan.java
@@ -27,7 +27,7 @@ import com.djrapitops.plan.system.locale.lang.PluginLang;
import com.djrapitops.plan.system.processing.importing.ImporterManager;
import com.djrapitops.plan.system.processing.importing.importers.OfflinePlayerImporter;
import com.djrapitops.plan.system.settings.theme.PlanColorScheme;
-import com.djrapitops.plan.utilities.metrics.BStats;
+import com.djrapitops.plan.utilities.metrics.BStatsBukkit;
import com.djrapitops.plugin.BukkitPlugin;
import com.djrapitops.plugin.StaticHolder;
import com.djrapitops.plugin.api.Benchmark;
@@ -65,13 +65,12 @@ public class Plan extends BukkitPlugin implements PlanPlugin {
try {
Benchmark.start("Enable");
system = new BukkitSystem(this);
- system.enable();
locale = system.getLocaleSystem().getLocale();
+ system.enable();
ImporterManager.registerImporter(new OfflinePlayerImporter());
- BStats bStats = new BStats(this);
- bStats.registerMetrics();
+ new BStatsBukkit(this).registerMetrics();
Log.debug("Verbose debug messages are enabled.");
Benchmark.stop("Enable", "Enable");
diff --git a/Plan/src/main/java/com/djrapitops/plan/PlanBungee.java b/Plan/src/main/java/com/djrapitops/plan/PlanBungee.java
index 1c5704843..9eb8aca1e 100644
--- a/Plan/src/main/java/com/djrapitops/plan/PlanBungee.java
+++ b/Plan/src/main/java/com/djrapitops/plan/PlanBungee.java
@@ -10,6 +10,7 @@ import com.djrapitops.plan.system.BungeeSystem;
import com.djrapitops.plan.system.locale.Locale;
import com.djrapitops.plan.system.locale.lang.PluginLang;
import com.djrapitops.plan.system.settings.theme.PlanColorScheme;
+import com.djrapitops.plan.utilities.metrics.BStatsBungee;
import com.djrapitops.plugin.BungeePlugin;
import com.djrapitops.plugin.StaticHolder;
import com.djrapitops.plugin.api.Benchmark;
@@ -40,8 +41,10 @@ public class PlanBungee extends BungeePlugin implements PlanPlugin {
super.onEnable();
try {
system = new BungeeSystem(this);
- system.enable();
locale = system.getLocaleSystem().getLocale();
+ system.enable();
+
+ new BStatsBungee(this).registerMetrics();
Log.info(locale.getString(PluginLang.ENABLED));
} catch (AbstractMethodError e) {
diff --git a/Plan/src/main/java/com/djrapitops/plan/PlanSponge.java b/Plan/src/main/java/com/djrapitops/plan/PlanSponge.java
index 7e8841f9b..93af49ff4 100644
--- a/Plan/src/main/java/com/djrapitops/plan/PlanSponge.java
+++ b/Plan/src/main/java/com/djrapitops/plan/PlanSponge.java
@@ -6,6 +6,7 @@ import com.djrapitops.plan.system.SpongeSystem;
import com.djrapitops.plan.system.locale.Locale;
import com.djrapitops.plan.system.locale.lang.PluginLang;
import com.djrapitops.plan.system.settings.theme.PlanColorScheme;
+import com.djrapitops.plan.utilities.metrics.BStatsSponge;
import com.djrapitops.plugin.SpongePlugin;
import com.djrapitops.plugin.StaticHolder;
import com.djrapitops.plugin.api.Benchmark;
@@ -23,7 +24,7 @@ import org.spongepowered.api.plugin.Plugin;
import java.io.File;
import java.io.InputStream;
-@Plugin(id = "plan", name = "Plan", version = "4.4.2", description = "Player Analytics Plugin by Rsl1122", authors = {"Rsl1122"})
+@Plugin(id = "plan", name = "Plan", version = "4.4.3", description = "Player Analytics Plugin by Rsl1122", authors = {"Rsl1122"})
public class PlanSponge extends SpongePlugin implements PlanPlugin {
@Inject
@@ -52,10 +53,12 @@ public class PlanSponge extends SpongePlugin implements PlanPlugin {
@Override
public void onEnable() {
super.onEnable();
- system = new SpongeSystem(this);
try {
- system.enable();
+ system = new SpongeSystem(this);
locale = system.getLocaleSystem().getLocale();
+ system.enable();
+
+ new BStatsSponge().registerMetrics();
Log.info(locale.getString(PluginLang.ENABLED));
} catch (AbstractMethodError e) {
diff --git a/Plan/src/main/java/com/djrapitops/plan/command/PlanBungeeCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/PlanBungeeCommand.java
index 8af457fd7..f709dc719 100644
--- a/Plan/src/main/java/com/djrapitops/plan/command/PlanBungeeCommand.java
+++ b/Plan/src/main/java/com/djrapitops/plan/command/PlanBungeeCommand.java
@@ -3,6 +3,7 @@ package com.djrapitops.plan.command;
import com.djrapitops.plan.PlanPlugin;
import com.djrapitops.plan.command.commands.*;
import com.djrapitops.plan.command.commands.manage.ManageConDebugCommand;
+import com.djrapitops.plan.command.commands.manage.ManageRawDataCommand;
import com.djrapitops.plan.system.locale.Locale;
import com.djrapitops.plan.system.locale.lang.DeepHelpLang;
import com.djrapitops.plan.system.settings.Permissions;
@@ -41,6 +42,7 @@ public class PlanBungeeCommand extends TreeCmdNode {
};
CommandNode[] manageGroup = {
new ManageConDebugCommand(plugin),
+ new ManageRawDataCommand(plugin),
new BungeeSetupToggleCommand(plugin),
new ReloadCommand(plugin),
new DisableCommand(plugin),
diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/ManageCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/ManageCommand.java
index 689771cc4..415888900 100644
--- a/Plan/src/main/java/com/djrapitops/plan/command/commands/ManageCommand.java
+++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/ManageCommand.java
@@ -28,6 +28,7 @@ public class ManageCommand extends TreeCmdNode {
super.setColorScheme(plugin.getColorScheme());
setNodeGroups(
new CommandNode[]{
+ new ManageRawDataCommand(plugin),
new ManageMoveCommand(plugin),
new ManageBackupCommand(plugin),
new ManageRestoreCommand(plugin),
diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/ReloadCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/ReloadCommand.java
index d44233459..4fb703aae 100644
--- a/Plan/src/main/java/com/djrapitops/plan/command/commands/ReloadCommand.java
+++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/ReloadCommand.java
@@ -10,6 +10,8 @@ import com.djrapitops.plugin.api.utility.log.Log;
import com.djrapitops.plugin.command.CommandNode;
import com.djrapitops.plugin.command.CommandType;
import com.djrapitops.plugin.command.ISender;
+import com.djrapitops.plugin.task.AbsRunnable;
+import com.djrapitops.plugin.task.RunnableFactory;
/**
* This SubCommand is used to reload the plugin.
@@ -34,12 +36,17 @@ public class ReloadCommand extends CommandNode {
@Override
public void onCommand(ISender sender, String commandLabel, String[] args) {
- try {
- plugin.reloadPlugin(true);
- } catch (Exception e) {
- Log.toLog(this.getClass(), e);
- sender.sendMessage(locale.getString(CommandLang.RELOAD_FAILED));
- }
- sender.sendMessage(locale.getString(CommandLang.RELOAD_COMPLETE));
+ RunnableFactory.createNew("Reload task", new AbsRunnable() {
+ @Override
+ public void run() {
+ try {
+ plugin.reloadPlugin(true);
+ } catch (Exception e) {
+ Log.toLog(this.getClass(), e);
+ sender.sendMessage(locale.getString(CommandLang.RELOAD_FAILED));
+ }
+ sender.sendMessage(locale.getString(CommandLang.RELOAD_COMPLETE));
+ }
+ }).runTaskAsynchronously();
}
}
diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageRawDataCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageRawDataCommand.java
new file mode 100644
index 000000000..6cbf86df0
--- /dev/null
+++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageRawDataCommand.java
@@ -0,0 +1,60 @@
+package com.djrapitops.plan.command.commands.manage;
+
+import com.djrapitops.plan.PlanPlugin;
+import com.djrapitops.plan.system.info.connection.ConnectionSystem;
+import com.djrapitops.plan.system.locale.Locale;
+import com.djrapitops.plan.system.locale.lang.CmdHelpLang;
+import com.djrapitops.plan.system.locale.lang.CommandLang;
+import com.djrapitops.plan.system.locale.lang.DeepHelpLang;
+import com.djrapitops.plan.system.settings.Permissions;
+import com.djrapitops.plan.utilities.MiscUtils;
+import com.djrapitops.plugin.command.CommandNode;
+import com.djrapitops.plugin.command.CommandType;
+import com.djrapitops.plugin.command.CommandUtils;
+import com.djrapitops.plugin.command.ISender;
+import com.djrapitops.plugin.utilities.Verify;
+
+import java.util.Arrays;
+
+/**
+ * This manage subcommand is used to remove a single player's data from the
+ * database.
+ *
+ * @author Rsl1122
+ */
+public class ManageRawDataCommand extends CommandNode {
+
+ private final Locale locale;
+
+ public ManageRawDataCommand(PlanPlugin plugin) {
+ super("raw", Permissions.MANAGE.getPermission(), CommandType.PLAYER_OR_ARGS);
+
+ locale = plugin.getSystem().getLocaleSystem().getLocale();
+
+ setArguments("");
+ setShortHelp(locale.getString(CmdHelpLang.MANAGE_RAW_DATA));
+ setInDepthHelp(locale.getArray(DeepHelpLang.MANAGE_RAW_DATA));
+ }
+
+ @Override
+ public void onCommand(ISender sender, String commandLabel, String[] args) {
+ Verify.isTrue(args.length >= 1,
+ () -> new IllegalArgumentException(locale.getString(CommandLang.FAIL_REQ_ONE_ARG, Arrays.toString(this.getArguments()))));
+
+ String playerName = MiscUtils.getPlayerName(args, sender, Permissions.MANAGE);
+
+ sender.sendMessage(locale.getString(CommandLang.HEADER_INSPECT, playerName));
+ // Link
+ String url = ConnectionSystem.getInstance().getMainAddress() + "/player/" + playerName + "/raw";
+ String linkPrefix = locale.getString(CommandLang.LINK_PREFIX);
+ boolean console = !CommandUtils.isPlayer(sender);
+ if (console) {
+ sender.sendMessage(linkPrefix + url);
+ } else {
+ sender.sendMessage(linkPrefix);
+ sender.sendLink(" ", locale.getString(CommandLang.LINK_CLICK_ME), url);
+ }
+
+ sender.sendMessage(">");
+ }
+}
diff --git a/Plan/src/main/java/com/djrapitops/plan/data/store/CachingSupplier.java b/Plan/src/main/java/com/djrapitops/plan/data/store/CachingSupplier.java
index 81726eb8b..ec3abff37 100644
--- a/Plan/src/main/java/com/djrapitops/plan/data/store/CachingSupplier.java
+++ b/Plan/src/main/java/com/djrapitops/plan/data/store/CachingSupplier.java
@@ -37,4 +37,12 @@ public class CachingSupplier implements Supplier {
}
return cachedValue;
}
+
+ public boolean isCached() {
+ return cachedValue != null;
+ }
+
+ public long getCacheTime() {
+ return cacheTime;
+ }
}
\ No newline at end of file
diff --git a/Plan/src/main/java/com/djrapitops/plan/data/store/containers/AnalysisContainer.java b/Plan/src/main/java/com/djrapitops/plan/data/store/containers/AnalysisContainer.java
index 0396fff06..be17d6d9b 100644
--- a/Plan/src/main/java/com/djrapitops/plan/data/store/containers/AnalysisContainer.java
+++ b/Plan/src/main/java/com/djrapitops/plan/data/store/containers/AnalysisContainer.java
@@ -13,7 +13,7 @@ import com.djrapitops.plan.data.store.mutators.health.HealthInformation;
import com.djrapitops.plan.data.time.WorldTimes;
import com.djrapitops.plan.system.database.databases.Database;
import com.djrapitops.plan.system.info.server.ServerInfo;
-import com.djrapitops.plan.system.info.server.ServerProperties;
+import com.djrapitops.plan.system.info.server.properties.ServerProperties;
import com.djrapitops.plan.system.settings.Settings;
import com.djrapitops.plan.system.settings.theme.Theme;
import com.djrapitops.plan.system.settings.theme.ThemeVal;
diff --git a/Plan/src/main/java/com/djrapitops/plan/data/store/containers/DataContainer.java b/Plan/src/main/java/com/djrapitops/plan/data/store/containers/DataContainer.java
index c2cefb496..96d7ca388 100644
--- a/Plan/src/main/java/com/djrapitops/plan/data/store/containers/DataContainer.java
+++ b/Plan/src/main/java/com/djrapitops/plan/data/store/containers/DataContainer.java
@@ -118,4 +118,8 @@ public class DataContainer {
public void clear() {
map.clear();
}
+
+ public Map getMap() {
+ return map;
+ }
}
\ No newline at end of file
diff --git a/Plan/src/main/java/com/djrapitops/plan/data/store/objects/Nickname.java b/Plan/src/main/java/com/djrapitops/plan/data/store/objects/Nickname.java
index 60fa052d0..c6972c9ca 100644
--- a/Plan/src/main/java/com/djrapitops/plan/data/store/objects/Nickname.java
+++ b/Plan/src/main/java/com/djrapitops/plan/data/store/objects/Nickname.java
@@ -21,7 +21,7 @@ public class Nickname implements DateHolder {
}
public String getName() {
- return name;
+ return name.length() <= 75 ? name : name.substring(0, 74);
}
@Override
diff --git a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/patches/NicknameLastSeenPatch.java b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/patches/NicknameLastSeenPatch.java
index 51c6a480e..a45bc697b 100644
--- a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/patches/NicknameLastSeenPatch.java
+++ b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/patches/NicknameLastSeenPatch.java
@@ -4,7 +4,6 @@ import com.djrapitops.plan.data.store.objects.Nickname;
import com.djrapitops.plan.system.database.databases.sql.SQLDB;
import com.djrapitops.plan.system.database.databases.sql.processing.ExecStatement;
import com.djrapitops.plan.system.database.databases.sql.processing.QueryAllStatement;
-import com.djrapitops.plan.system.database.databases.sql.tables.GeoInfoTable;
import com.djrapitops.plan.system.database.databases.sql.tables.NicknamesTable;
import com.djrapitops.plan.system.database.databases.sql.tables.UserIDTable;
@@ -21,7 +20,7 @@ public class NicknameLastSeenPatch extends Patch {
@Override
public boolean hasBeenApplied() {
- return hasColumn(GeoInfoTable.TABLE_NAME, GeoInfoTable.Col.LAST_USED.get());
+ return hasColumn(NicknamesTable.TABLE_NAME, NicknamesTable.Col.LAST_USED.get());
}
@Override
diff --git a/Plan/src/main/java/com/djrapitops/plan/system/info/connection/ConnectionOut.java b/Plan/src/main/java/com/djrapitops/plan/system/info/connection/ConnectionOut.java
index 36da124b8..1a8791442 100644
--- a/Plan/src/main/java/com/djrapitops/plan/system/info/connection/ConnectionOut.java
+++ b/Plan/src/main/java/com/djrapitops/plan/system/info/connection/ConnectionOut.java
@@ -10,6 +10,7 @@ import com.djrapitops.plan.system.info.request.InfoRequestWithVariables;
import com.djrapitops.plan.system.info.server.Server;
import com.djrapitops.plan.system.settings.Settings;
import com.djrapitops.plan.utilities.MiscUtils;
+import com.djrapitops.plugin.api.TimeAmount;
import com.djrapitops.plugin.api.utility.log.Log;
import com.djrapitops.plugin.utilities.Verify;
import org.apache.http.client.config.RequestConfig;
@@ -29,6 +30,7 @@ import java.security.KeyManagementException;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.util.Map;
+import java.util.Properties;
import java.util.UUID;
/**
@@ -42,6 +44,17 @@ public class ConnectionOut {
private final UUID serverUUID;
private final InfoRequest infoRequest;
+ static {
+ try {
+ Properties properties = System.getProperties();
+ properties.setProperty("sun.net.client.defaultConnectTimeout", Long.toString(TimeAmount.MINUTE.ms()));
+ properties.setProperty("sun.net.client.defaultReadTimeout", Long.toString(TimeAmount.MINUTE.ms()));
+ properties.setProperty("sun.net.http.retryPost", Boolean.toString(false));
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
/**
* Constructor.
*
@@ -118,10 +131,12 @@ public class ConnectionOut {
private void prepareRequest(HttpPost post, String parameters) {
RequestConfig requestConfig = RequestConfig.custom()
- .setConnectionRequestTimeout(10000)
+ .setConnectionRequestTimeout(5000)
+ .setSocketTimeout(10000)
+ .setConnectTimeout(9000)
+ .setRedirectsEnabled(true)
.setRelativeRedirectsAllowed(true)
.setContentCompressionEnabled(true)
- .setMaxRedirects(1)
.build();
post.setConfig(requestConfig);
diff --git a/Plan/src/main/java/com/djrapitops/plan/system/info/request/SaveDBSettingsRequest.java b/Plan/src/main/java/com/djrapitops/plan/system/info/request/SaveDBSettingsRequest.java
index 5d321c4b0..078f7ea6e 100644
--- a/Plan/src/main/java/com/djrapitops/plan/system/info/request/SaveDBSettingsRequest.java
+++ b/Plan/src/main/java/com/djrapitops/plan/system/info/request/SaveDBSettingsRequest.java
@@ -12,7 +12,10 @@ import com.djrapitops.plan.system.webserver.response.DefaultResponses;
import com.djrapitops.plan.system.webserver.response.Response;
import com.djrapitops.plan.system.webserver.response.api.BadRequestResponse;
import com.djrapitops.plugin.api.Check;
+import com.djrapitops.plugin.api.TimeAmount;
import com.djrapitops.plugin.api.utility.log.Log;
+import com.djrapitops.plugin.task.AbsRunnable;
+import com.djrapitops.plugin.task.RunnableFactory;
import com.djrapitops.plugin.utilities.Verify;
import java.util.Map;
@@ -64,7 +67,12 @@ public class SaveDBSettingsRequest extends InfoRequestWithVariables implements S
Log.info("----------------------------------");
return DefaultResponses.SUCCESS.get();
} finally {
- PlanPlugin.getInstance().reloadPlugin(true);
+ RunnableFactory.createNew("Bungee Setup Restart Task", new AbsRunnable() {
+ @Override
+ public void run() {
+ PlanPlugin.getInstance().reloadPlugin(true);
+ }
+ }).runTaskLater(TimeAmount.SECOND.ticks() * 2L);
}
}
diff --git a/Plan/src/main/java/com/djrapitops/plan/system/info/request/SendDBSettingsRequest.java b/Plan/src/main/java/com/djrapitops/plan/system/info/request/SendDBSettingsRequest.java
index 353eeaf6e..7362b44b8 100644
--- a/Plan/src/main/java/com/djrapitops/plan/system/info/request/SendDBSettingsRequest.java
+++ b/Plan/src/main/java/com/djrapitops/plan/system/info/request/SendDBSettingsRequest.java
@@ -56,6 +56,9 @@ public class SendDBSettingsRequest extends InfoRequestWithVariables implements S
if (Check.isBukkitAvailable()) {
return new BadRequestResponse("Not supposed to be called on a Bukkit server");
}
+ if (Check.isSpongeAvailable()) {
+ return new BadRequestResponse("Not supposed to be called on a Sponge server");
+ }
String address = variables.get("address");
Verify.nullCheck(address, () -> new BadRequestException("WebServer Address ('address') not specified in the request."));
diff --git a/Plan/src/main/java/com/djrapitops/plan/system/info/server/BukkitServerInfo.java b/Plan/src/main/java/com/djrapitops/plan/system/info/server/BukkitServerInfo.java
index 7353f347a..0984066f9 100644
--- a/Plan/src/main/java/com/djrapitops/plan/system/info/server/BukkitServerInfo.java
+++ b/Plan/src/main/java/com/djrapitops/plan/system/info/server/BukkitServerInfo.java
@@ -9,6 +9,8 @@ import com.djrapitops.plan.api.exceptions.EnableException;
import com.djrapitops.plan.api.exceptions.database.DBOpException;
import com.djrapitops.plan.system.database.databases.Database;
import com.djrapitops.plan.system.file.FileSystem;
+import com.djrapitops.plan.system.info.server.properties.BukkitServerProperties;
+import com.djrapitops.plan.system.info.server.properties.ServerProperties;
import com.djrapitops.plan.system.settings.Settings;
import com.djrapitops.plan.system.webserver.WebServerSystem;
@@ -29,7 +31,7 @@ public class BukkitServerInfo extends ServerInfo {
private Database database;
public BukkitServerInfo(Plan plugin) {
- this(new ServerProperties(plugin.getServer()));
+ this(new BukkitServerProperties(plugin.getServer()));
}
public BukkitServerInfo(ServerProperties serverProperties) {
diff --git a/Plan/src/main/java/com/djrapitops/plan/system/info/server/BungeeServerInfo.java b/Plan/src/main/java/com/djrapitops/plan/system/info/server/BungeeServerInfo.java
index c98fa570a..c0658b8fa 100644
--- a/Plan/src/main/java/com/djrapitops/plan/system/info/server/BungeeServerInfo.java
+++ b/Plan/src/main/java/com/djrapitops/plan/system/info/server/BungeeServerInfo.java
@@ -8,6 +8,8 @@ import com.djrapitops.plan.PlanBungee;
import com.djrapitops.plan.api.exceptions.EnableException;
import com.djrapitops.plan.api.exceptions.database.DBOpException;
import com.djrapitops.plan.system.database.databases.Database;
+import com.djrapitops.plan.system.info.server.properties.BungeeServerProperties;
+import com.djrapitops.plan.system.info.server.properties.ServerProperties;
import com.djrapitops.plan.system.webserver.WebServerSystem;
import com.djrapitops.plugin.api.utility.log.Log;
@@ -22,7 +24,7 @@ import java.util.UUID;
public class BungeeServerInfo extends ServerInfo {
public BungeeServerInfo(PlanBungee plugin) {
- super(new ServerProperties(plugin.getProxy()));
+ super(new BungeeServerProperties(plugin.getProxy()));
}
@Override
diff --git a/Plan/src/main/java/com/djrapitops/plan/system/info/server/ServerInfo.java b/Plan/src/main/java/com/djrapitops/plan/system/info/server/ServerInfo.java
index c12522cb7..9ba36b991 100644
--- a/Plan/src/main/java/com/djrapitops/plan/system/info/server/ServerInfo.java
+++ b/Plan/src/main/java/com/djrapitops/plan/system/info/server/ServerInfo.java
@@ -7,6 +7,7 @@ package com.djrapitops.plan.system.info.server;
import com.djrapitops.plan.api.exceptions.EnableException;
import com.djrapitops.plan.system.PlanSystem;
import com.djrapitops.plan.system.SubSystem;
+import com.djrapitops.plan.system.info.server.properties.ServerProperties;
import com.djrapitops.plugin.utilities.Verify;
import java.util.UUID;
diff --git a/Plan/src/main/java/com/djrapitops/plan/system/info/server/SpongeServerInfo.java b/Plan/src/main/java/com/djrapitops/plan/system/info/server/SpongeServerInfo.java
index 0368e6073..b82b09321 100644
--- a/Plan/src/main/java/com/djrapitops/plan/system/info/server/SpongeServerInfo.java
+++ b/Plan/src/main/java/com/djrapitops/plan/system/info/server/SpongeServerInfo.java
@@ -1,10 +1,11 @@
package com.djrapitops.plan.system.info.server;
+import com.djrapitops.plan.system.info.server.properties.SpongeServerProperties;
import org.spongepowered.api.Sponge;
public class SpongeServerInfo extends BukkitServerInfo {
public SpongeServerInfo() {
- super(new ServerProperties(Sponge.getGame()));
+ super(new SpongeServerProperties(Sponge.getGame()));
}
}
diff --git a/Plan/src/main/java/com/djrapitops/plan/system/info/server/properties/BukkitServerProperties.java b/Plan/src/main/java/com/djrapitops/plan/system/info/server/properties/BukkitServerProperties.java
new file mode 100644
index 000000000..8f664a9ae
--- /dev/null
+++ b/Plan/src/main/java/com/djrapitops/plan/system/info/server/properties/BukkitServerProperties.java
@@ -0,0 +1,25 @@
+package com.djrapitops.plan.system.info.server.properties;
+
+import org.bukkit.Server;
+
+/**
+ * ServerProperties for Bukkit.
+ *
+ * @author Rsl1122
+ */
+public class BukkitServerProperties extends ServerProperties {
+
+ public BukkitServerProperties(Server server) {
+ super(
+ server.getServerId(),
+ server.getName(),
+ server.getPort(),
+ server.getVersion(),
+ server.getBukkitVersion(),
+ server::getIp,
+ server.getMaxPlayers(),
+ () -> server.getOnlinePlayers().size()
+ );
+ }
+
+}
\ No newline at end of file
diff --git a/Plan/src/main/java/com/djrapitops/plan/system/info/server/properties/BungeeServerProperties.java b/Plan/src/main/java/com/djrapitops/plan/system/info/server/properties/BungeeServerProperties.java
new file mode 100644
index 000000000..4f6c2cc39
--- /dev/null
+++ b/Plan/src/main/java/com/djrapitops/plan/system/info/server/properties/BungeeServerProperties.java
@@ -0,0 +1,27 @@
+package com.djrapitops.plan.system.info.server.properties;
+
+import com.djrapitops.plan.system.settings.Settings;
+import net.md_5.bungee.api.ProxyServer;
+
+/**
+ * ServerProperties for Bungee.
+ *
+ * Supports RedisBungee for Players online getting.
+ *
+ * @author Rsl1122
+ */
+public class BungeeServerProperties extends ServerProperties {
+
+ public BungeeServerProperties(ProxyServer server) {
+ super(
+ server.getServers().toString(),
+ "BungeeCord",
+ -1,
+ server.getVersion(),
+ server.getVersion(),
+ Settings.BUNGEE_IP::toString,
+ server.getConfig().getPlayerLimit(),
+ RedisCheck.isClassAvailable() ? new RedisPlayersOnlineSupplier() : server::getOnlineCount
+ );
+ }
+}
\ No newline at end of file
diff --git a/Plan/src/main/java/com/djrapitops/plan/system/info/server/properties/RedisCheck.java b/Plan/src/main/java/com/djrapitops/plan/system/info/server/properties/RedisCheck.java
new file mode 100644
index 000000000..d25fc7a0b
--- /dev/null
+++ b/Plan/src/main/java/com/djrapitops/plan/system/info/server/properties/RedisCheck.java
@@ -0,0 +1,19 @@
+package com.djrapitops.plan.system.info.server.properties;
+
+/**
+ * Utility class for checking if RedisBungee API is available.
+ *
+ * @author Rsl1122
+ */
+public class RedisCheck {
+
+ public static boolean isClassAvailable() {
+ try {
+ Class.forName("com.imaginarycode.minecraft.redisbungee.RedisBungeeAPI");
+ return true;
+ } catch (ClassNotFoundException e) {
+ return false;
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/Plan/src/main/java/com/djrapitops/plan/system/info/server/properties/RedisPlayersOnlineSupplier.java b/Plan/src/main/java/com/djrapitops/plan/system/info/server/properties/RedisPlayersOnlineSupplier.java
new file mode 100644
index 000000000..1d3a2f28a
--- /dev/null
+++ b/Plan/src/main/java/com/djrapitops/plan/system/info/server/properties/RedisPlayersOnlineSupplier.java
@@ -0,0 +1,18 @@
+package com.djrapitops.plan.system.info.server.properties;
+
+import com.imaginarycode.minecraft.redisbungee.RedisBungee;
+
+import java.util.function.Supplier;
+
+/**
+ * Players online supplier when using RedisBungee.
+ *
+ * @author Rsl1122
+ */
+public class RedisPlayersOnlineSupplier implements Supplier {
+
+ @Override
+ public Integer get() {
+ return RedisBungee.getApi().getPlayerCount();
+ }
+}
\ No newline at end of file
diff --git a/Plan/src/main/java/com/djrapitops/plan/system/info/server/ServerProperties.java b/Plan/src/main/java/com/djrapitops/plan/system/info/server/properties/ServerProperties.java
similarity index 66%
rename from Plan/src/main/java/com/djrapitops/plan/system/info/server/ServerProperties.java
rename to Plan/src/main/java/com/djrapitops/plan/system/info/server/properties/ServerProperties.java
index 497663815..cd58e2f7b 100644
--- a/Plan/src/main/java/com/djrapitops/plan/system/info/server/ServerProperties.java
+++ b/Plan/src/main/java/com/djrapitops/plan/system/info/server/properties/ServerProperties.java
@@ -1,8 +1,5 @@
-package com.djrapitops.plan.system.info.server;
+package com.djrapitops.plan.system.info.server.properties;
-import com.djrapitops.plan.system.settings.Settings;
-import net.md_5.bungee.api.ProxyServer;
-import org.bukkit.Server;
import org.spongepowered.api.Game;
import java.net.InetSocketAddress;
@@ -15,7 +12,7 @@ import java.util.function.Supplier;
* @author Rsl1122
* @since 3.4.1
*/
-public class ServerProperties {
+public abstract class ServerProperties {
private final String id;
private final String name;
@@ -27,30 +24,18 @@ public class ServerProperties {
private final Supplier onlinePlayers;
- public ServerProperties(Server server) {
- id = server.getServerId();
- ip = server::getIp;
- name = server.getName();
- port = server.getPort();
- version = server.getVersion();
- implVersion = server.getBukkitVersion();
-
- maxPlayers = server.getMaxPlayers();
-
- onlinePlayers = () -> server.getOnlinePlayers().size();
- }
-
- public ServerProperties(ProxyServer server) {
- id = server.getServers().toString();
- ip = Settings.BUNGEE_IP::toString;
- name = "BungeeCord";
- port = -1;
- version = server.getVersion();
- implVersion = server.getVersion();
-
- maxPlayers = server.getConfig().getPlayerLimit();
-
- onlinePlayers = server::getOnlineCount;
+ protected ServerProperties(
+ String id, String name, int port,
+ String version, String implVersion,
+ Supplier ip, int maxPlayers, Supplier onlinePlayers) {
+ this.id = id;
+ this.name = name;
+ this.port = port;
+ this.version = version;
+ this.implVersion = implVersion;
+ this.ip = ip;
+ this.maxPlayers = maxPlayers;
+ this.onlinePlayers = onlinePlayers;
}
public ServerProperties(Game game) {
diff --git a/Plan/src/main/java/com/djrapitops/plan/system/info/server/properties/SpongeServerProperties.java b/Plan/src/main/java/com/djrapitops/plan/system/info/server/properties/SpongeServerProperties.java
new file mode 100644
index 000000000..1e9a4121b
--- /dev/null
+++ b/Plan/src/main/java/com/djrapitops/plan/system/info/server/properties/SpongeServerProperties.java
@@ -0,0 +1,28 @@
+package com.djrapitops.plan.system.info.server.properties;
+
+import org.spongepowered.api.Game;
+
+import java.net.InetSocketAddress;
+
+/**
+ * ServerProperties for Sponge.
+ *
+ * @author Rsl1122
+ */
+public class SpongeServerProperties extends ServerProperties {
+
+ public SpongeServerProperties(Game game) {
+ super(
+ game.getServer().getMotd().toPlain(),
+ "Sponge",
+ game.getServer().getBoundAddress().orElseGet(() -> new InetSocketAddress(25565)).getPort(),
+ game.getPlatform().getMinecraftVersion().getName(),
+ game.getPlatform().getMinecraftVersion().getName(),
+ () -> game.getServer().getBoundAddress()
+ .orElseGet(() -> new InetSocketAddress(25565))
+ .getAddress().getHostAddress(),
+ game.getServer().getMaxPlayers(),
+ () -> game.getServer().getOnlinePlayers().size()
+ );
+ }
+}
\ No newline at end of file
diff --git a/Plan/src/main/java/com/djrapitops/plan/system/listeners/bukkit/PlayerOnlineListener.java b/Plan/src/main/java/com/djrapitops/plan/system/listeners/bukkit/PlayerOnlineListener.java
index 23d34756a..c28f0f4a8 100644
--- a/Plan/src/main/java/com/djrapitops/plan/system/listeners/bukkit/PlayerOnlineListener.java
+++ b/Plan/src/main/java/com/djrapitops/plan/system/listeners/bukkit/PlayerOnlineListener.java
@@ -8,6 +8,7 @@ import com.djrapitops.plan.system.processing.processors.info.PlayerPageUpdatePro
import com.djrapitops.plan.system.processing.processors.player.*;
import com.djrapitops.plugin.api.systems.NotificationCenter;
import com.djrapitops.plugin.api.utility.log.Log;
+import com.djrapitops.plugin.task.RunnableFactory;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
@@ -96,13 +97,13 @@ public class PlayerOnlineListener implements Listener {
SessionCache.getInstance().cacheSession(uuid, new Session(uuid, time, world, gm));
- Processing.submit(
+ RunnableFactory.createNew("Player Register: " + uuid,
new RegisterProcessor(uuid, player::getFirstPlayed, playerName,
new IPUpdateProcessor(uuid, address, time),
new NameProcessor(uuid, playerName, displayName),
new PlayerPageUpdateProcessor(uuid)
)
- );
+ ).runTaskAsynchronously();
Processing.submit(new NetworkPageUpdateProcessor());
}
diff --git a/Plan/src/main/java/com/djrapitops/plan/system/listeners/sponge/SpongePlayerListener.java b/Plan/src/main/java/com/djrapitops/plan/system/listeners/sponge/SpongePlayerListener.java
index a302f2bd2..d0f4c478c 100644
--- a/Plan/src/main/java/com/djrapitops/plan/system/listeners/sponge/SpongePlayerListener.java
+++ b/Plan/src/main/java/com/djrapitops/plan/system/listeners/sponge/SpongePlayerListener.java
@@ -8,6 +8,7 @@ import com.djrapitops.plan.system.processing.processors.info.PlayerPageUpdatePro
import com.djrapitops.plan.system.processing.processors.player.*;
import com.djrapitops.plugin.api.systems.NotificationCenter;
import com.djrapitops.plugin.api.utility.log.Log;
+import com.djrapitops.plugin.task.RunnableFactory;
import org.spongepowered.api.Sponge;
import org.spongepowered.api.data.key.Keys;
import org.spongepowered.api.entity.living.player.Player;
@@ -99,13 +100,13 @@ public class SpongePlayerListener {
SessionCache.getInstance().cacheSession(uuid, new Session(uuid, time, world, gm));
- Processing.submit(
+ RunnableFactory.createNew("Player Register: " + uuid,
new RegisterProcessor(uuid, () -> time, playerName,
new IPUpdateProcessor(uuid, address, time),
new NameProcessor(uuid, playerName, displayName),
new PlayerPageUpdateProcessor(uuid)
)
- );
+ ).runTaskAsynchronously();
Processing.submit(new NetworkPageUpdateProcessor());
}
diff --git a/Plan/src/main/java/com/djrapitops/plan/system/locale/lang/CmdHelpLang.java b/Plan/src/main/java/com/djrapitops/plan/system/locale/lang/CmdHelpLang.java
index 8a228462f..ce3dfba9a 100644
--- a/Plan/src/main/java/com/djrapitops/plan/system/locale/lang/CmdHelpLang.java
+++ b/Plan/src/main/java/com/djrapitops/plan/system/locale/lang/CmdHelpLang.java
@@ -39,7 +39,8 @@ public enum CmdHelpLang implements Lang {
WEB_LEVEL("Command Help - /plan web level", "Information about permission levels"),
WEB_LIST("Command Help - /plan web list", "List Web Users"),
WEB_CHECK("Command Help - /plan web check", "Inspect a Web User"),
- WEB_DELETE("Command Help - /plan web delete", "Delete a Web User");
+ WEB_DELETE("Command Help - /plan web delete", "Delete a Web User"),
+ MANAGE_RAW_DATA("Command Help - /plan manage raw", "View raw JSON of player data");
private final String identifier;
private final String defaultValue;
diff --git a/Plan/src/main/java/com/djrapitops/plan/system/locale/lang/DeepHelpLang.java b/Plan/src/main/java/com/djrapitops/plan/system/locale/lang/DeepHelpLang.java
index e7f4b498f..b4f3657d4 100644
--- a/Plan/src/main/java/com/djrapitops/plan/system/locale/lang/DeepHelpLang.java
+++ b/Plan/src/main/java/com/djrapitops/plan/system/locale/lang/DeepHelpLang.java
@@ -31,7 +31,8 @@ public enum DeepHelpLang implements Lang {
MANAGE_RESTORE("In Depth Help - /plan manage restore ?", "> §2Restore Subcommand\\ Restore a previous backup SQLite database (.db file)\\ You can also restore database.db from another server to MySQL.\\ Target database is cleared before transfer."),
MANAGE_SETUP("In Depth Help - /plan manage setup ?", "> §2Setup Subcommand\\ Set-up a connection between Bungee and this server for network functionality.\\ BungeeAddress can be found in the enable log on console when Plan enables on Bungee."),
- WEB_REGISTER("In Depth Help - /plan web register ?", "> §2Register Subcommand\\ Registers a new Web User.\\ Registering a user for another player requires plan.webmanage permission.\\ Passwords are hashed with PBKDF2 (64,000 iterations of SHA1) using a cryptographically-random salt.");
+ WEB_REGISTER("In Depth Help - /plan web register ?", "> §2Register Subcommand\\ Registers a new Web User.\\ Registering a user for another player requires plan.webmanage permission.\\ Passwords are hashed with PBKDF2 (64,000 iterations of SHA1) using a cryptographically-random salt."),
+ MANAGE_RAW_DATA("In Depth Help - /plan manage raw ?", "> §2Raw Data Subcommand\\ Displays link to raw JSON data page.\\ Not available if Plan webserver is not enabled.");
private final String identifier;
private final String defaultValue;
diff --git a/Plan/src/main/java/com/djrapitops/plan/system/processing/Processing.java b/Plan/src/main/java/com/djrapitops/plan/system/processing/Processing.java
index ac2326af6..35a039693 100644
--- a/Plan/src/main/java/com/djrapitops/plan/system/processing/Processing.java
+++ b/Plan/src/main/java/com/djrapitops/plan/system/processing/Processing.java
@@ -143,6 +143,16 @@ public class Processing implements SubSystem {
Log.toLog(this.getClass(), e);
}
}
+ if (!nonCriticalExecutor.isTerminated()) {
+ try {
+ nonCriticalExecutor.awaitTermination(1, TimeUnit.SECONDS);
+ } catch (InterruptedException e) {
+ nonCriticalExecutor.shutdownNow();
+ }
+ }
+ if (!criticalExecutor.isTerminated()) {
+ criticalExecutor.shutdownNow();
+ }
Log.info(locale.get().getString(PluginLang.DISABLED_PROCESSING_COMPLETE));
}
}
diff --git a/Plan/src/main/java/com/djrapitops/plan/system/processing/processors/player/RegisterProcessor.java b/Plan/src/main/java/com/djrapitops/plan/system/processing/processors/player/RegisterProcessor.java
index 2cc024848..c0487ebee 100644
--- a/Plan/src/main/java/com/djrapitops/plan/system/processing/processors/player/RegisterProcessor.java
+++ b/Plan/src/main/java/com/djrapitops/plan/system/processing/processors/player/RegisterProcessor.java
@@ -5,8 +5,8 @@
package com.djrapitops.plan.system.processing.processors.player;
import com.djrapitops.plan.system.database.databases.Database;
-import com.djrapitops.plan.system.processing.CriticalRunnable;
import com.djrapitops.plan.system.processing.Processing;
+import com.djrapitops.plugin.task.AbsRunnable;
import com.djrapitops.plugin.utilities.Verify;
import java.util.UUID;
@@ -17,7 +17,7 @@ import java.util.function.Supplier;
*
* @author Rsl1122
*/
-public class RegisterProcessor implements CriticalRunnable {
+public class RegisterProcessor extends AbsRunnable {
private final UUID uuid;
private final Supplier registered;
@@ -25,6 +25,7 @@ public class RegisterProcessor implements CriticalRunnable {
private final Runnable[] afterProcess;
public RegisterProcessor(UUID uuid, Supplier registered, String name, Runnable... afterProcess) {
+ super(RegisterProcessor.class.getSimpleName());
this.uuid = uuid;
this.registered = registered;
this.name = name;
@@ -46,6 +47,7 @@ public class RegisterProcessor implements CriticalRunnable {
for (Runnable runnable : afterProcess) {
Processing.submit(runnable);
}
+ cancel();
}
}
}
diff --git a/Plan/src/main/java/com/djrapitops/plan/system/tasks/bungee/BungeeTPSCountTimer.java b/Plan/src/main/java/com/djrapitops/plan/system/tasks/bungee/BungeeTPSCountTimer.java
index 058ca284e..2d5edb328 100644
--- a/Plan/src/main/java/com/djrapitops/plan/system/tasks/bungee/BungeeTPSCountTimer.java
+++ b/Plan/src/main/java/com/djrapitops/plan/system/tasks/bungee/BungeeTPSCountTimer.java
@@ -3,6 +3,7 @@ package com.djrapitops.plan.system.tasks.bungee;
import com.djrapitops.plan.PlanBungee;
import com.djrapitops.plan.data.container.TPS;
import com.djrapitops.plan.data.container.builders.TPSBuilder;
+import com.djrapitops.plan.system.info.server.ServerInfo;
import com.djrapitops.plan.system.tasks.TPSCountTimer;
public class BungeeTPSCountTimer extends TPSCountTimer {
@@ -13,7 +14,7 @@ public class BungeeTPSCountTimer extends TPSCountTimer {
@Override
public void addNewTPSEntry(long nanoTime, long now) {
- int onlineCount = plugin.getProxy().getOnlineCount();
+ int onlineCount = ServerInfo.getServerProperties().getOnlinePlayers();
TPS tps = TPSBuilder.get()
.date(now)
.skipTPS()
diff --git a/Plan/src/main/java/com/djrapitops/plan/system/webserver/pages/PlayerPageHandler.java b/Plan/src/main/java/com/djrapitops/plan/system/webserver/pages/PlayerPageHandler.java
index bead14036..922550a12 100644
--- a/Plan/src/main/java/com/djrapitops/plan/system/webserver/pages/PlayerPageHandler.java
+++ b/Plan/src/main/java/com/djrapitops/plan/system/webserver/pages/PlayerPageHandler.java
@@ -19,6 +19,7 @@ import com.djrapitops.plan.system.webserver.response.cache.PageId;
import com.djrapitops.plan.system.webserver.response.cache.ResponseCache;
import com.djrapitops.plan.system.webserver.response.errors.NotFoundResponse;
import com.djrapitops.plan.system.webserver.response.pages.InspectPageResponse;
+import com.djrapitops.plan.system.webserver.response.pages.RawPlayerDataResponse;
import com.djrapitops.plan.utilities.uuid.UUIDUtility;
import java.util.List;
@@ -41,17 +42,17 @@ public class PlayerPageHandler extends PageHandler {
UUID uuid = UUIDUtility.getUUIDOf(playerName);
Locale locale = request.getLocale();
+ boolean raw = target.size() >= 2 && target.get(1).equalsIgnoreCase("raw");
+
if (uuid == null) {
return notFound(locale.getString(ErrorPageLang.UUID_404));
}
try {
if (Database.getActive().check().isPlayerRegistered(uuid)) {
- Response response = ResponseCache.loadResponse(PageId.PLAYER.of(uuid));
- if (!(response instanceof InspectPageResponse)) {
- InfoSystem.getInstance().generateAndCachePlayerPage(uuid);
- response = ResponseCache.loadResponse(PageId.PLAYER.of(uuid));
+ if (raw) {
+ return ResponseCache.loadResponse(PageId.RAW_PLAYER.of(uuid), () -> new RawPlayerDataResponse(uuid));
}
- return response != null ? response : notFound(locale.getString(ErrorPageLang.NO_SERVERS_404));
+ return playerResponseOrNotFound(uuid, locale);
} else {
return notFound(locale.getString(ErrorPageLang.NOT_PLAYED_404));
}
@@ -61,6 +62,15 @@ public class PlayerPageHandler extends PageHandler {
return InspectPageResponse.getRefreshing();
}
+ private Response playerResponseOrNotFound(UUID uuid, Locale locale) throws WebException {
+ Response response = ResponseCache.loadResponse(PageId.PLAYER.of(uuid));
+ if (!(response instanceof InspectPageResponse)) {
+ InfoSystem.getInstance().generateAndCachePlayerPage(uuid);
+ response = ResponseCache.loadResponse(PageId.PLAYER.of(uuid));
+ }
+ return response != null ? response : notFound(locale.getString(ErrorPageLang.NO_SERVERS_404));
+ }
+
private Response notFound(String error) {
return ResponseCache.loadResponse(PageId.NOT_FOUND.of(error), () -> new NotFoundResponse(error));
}
diff --git a/Plan/src/main/java/com/djrapitops/plan/system/webserver/pages/ServerPageHandler.java b/Plan/src/main/java/com/djrapitops/plan/system/webserver/pages/ServerPageHandler.java
index c59029c42..9cd01151a 100644
--- a/Plan/src/main/java/com/djrapitops/plan/system/webserver/pages/ServerPageHandler.java
+++ b/Plan/src/main/java/com/djrapitops/plan/system/webserver/pages/ServerPageHandler.java
@@ -15,6 +15,7 @@ import com.djrapitops.plan.system.webserver.response.Response;
import com.djrapitops.plan.system.webserver.response.cache.PageId;
import com.djrapitops.plan.system.webserver.response.cache.ResponseCache;
import com.djrapitops.plan.system.webserver.response.pages.AnalysisPageResponse;
+import com.djrapitops.plan.system.webserver.response.pages.RawServerDataResponse;
import com.djrapitops.plugin.api.Check;
import java.util.List;
@@ -31,6 +32,12 @@ public class ServerPageHandler extends PageHandler {
@Override
public Response getResponse(Request request, List target) {
UUID serverUUID = getServerUUID(target);
+
+ boolean raw = target.size() >= 2 && target.get(1).equalsIgnoreCase("raw");
+ if (raw) {
+ return ResponseCache.loadResponse(PageId.RAW_SERVER.of(serverUUID), () -> new RawServerDataResponse(serverUUID));
+ }
+
Response response = ResponseCache.loadResponse(PageId.SERVER.of(serverUUID));
if (response != null) {
diff --git a/Plan/src/main/java/com/djrapitops/plan/system/webserver/response/cache/PageId.java b/Plan/src/main/java/com/djrapitops/plan/system/webserver/response/cache/PageId.java
index f1b657004..a5417b6c9 100644
--- a/Plan/src/main/java/com/djrapitops/plan/system/webserver/response/cache/PageId.java
+++ b/Plan/src/main/java/com/djrapitops/plan/system/webserver/response/cache/PageId.java
@@ -14,7 +14,9 @@ import java.util.UUID;
public enum PageId {
SERVER("serverPage:"),
+ RAW_SERVER("rawServer:"),
PLAYER("playerPage:"),
+ RAW_PLAYER("rawPlayer:"),
PLAYERS("playersPage"),
ERROR("error:"),
diff --git a/Plan/src/main/java/com/djrapitops/plan/system/webserver/response/cache/ResponseCache.java b/Plan/src/main/java/com/djrapitops/plan/system/webserver/response/cache/ResponseCache.java
index 7b2a3a433..7960f51ed 100644
--- a/Plan/src/main/java/com/djrapitops/plan/system/webserver/response/cache/ResponseCache.java
+++ b/Plan/src/main/java/com/djrapitops/plan/system/webserver/response/cache/ResponseCache.java
@@ -4,6 +4,7 @@ import com.djrapitops.plan.system.webserver.response.Response;
import java.util.HashMap;
import java.util.Map;
+import java.util.Set;
import java.util.function.Supplier;
/**
@@ -93,4 +94,7 @@ public class ResponseCache {
cache.clear();
}
+ public static Set getCacheKeys() {
+ return cache.keySet();
+ }
}
diff --git a/Plan/src/main/java/com/djrapitops/plan/system/webserver/response/pages/DebugPageResponse.java b/Plan/src/main/java/com/djrapitops/plan/system/webserver/response/pages/DebugPageResponse.java
index b31b49cb0..cc62f669b 100644
--- a/Plan/src/main/java/com/djrapitops/plan/system/webserver/response/pages/DebugPageResponse.java
+++ b/Plan/src/main/java/com/djrapitops/plan/system/webserver/response/pages/DebugPageResponse.java
@@ -5,19 +5,28 @@
package com.djrapitops.plan.system.webserver.response.pages;
import com.djrapitops.plan.PlanPlugin;
+import com.djrapitops.plan.data.container.Session;
+import com.djrapitops.plan.data.store.CachingSupplier;
+import com.djrapitops.plan.data.store.Key;
+import com.djrapitops.plan.data.store.keys.SessionKeys;
import com.djrapitops.plan.data.store.mutators.formatting.Formatter;
import com.djrapitops.plan.data.store.mutators.formatting.Formatters;
import com.djrapitops.plan.data.store.objects.DateHolder;
+import com.djrapitops.plan.system.cache.CacheSystem;
+import com.djrapitops.plan.system.cache.SessionCache;
import com.djrapitops.plan.system.database.databases.Database;
import com.djrapitops.plan.system.info.connection.ConnectionLog;
import com.djrapitops.plan.system.info.connection.ConnectionSystem;
import com.djrapitops.plan.system.info.server.Server;
import com.djrapitops.plan.system.info.server.ServerInfo;
-import com.djrapitops.plan.system.info.server.ServerProperties;
+import com.djrapitops.plan.system.info.server.properties.ServerProperties;
+import com.djrapitops.plan.system.webserver.response.cache.ResponseCache;
import com.djrapitops.plan.system.webserver.response.errors.ErrorResponse;
import com.djrapitops.plan.utilities.file.FileUtil;
import com.djrapitops.plan.utilities.html.Html;
+import com.djrapitops.plan.utilities.html.HtmlStructure;
import com.djrapitops.plan.utilities.html.icon.Icon;
+import com.djrapitops.plan.utilities.html.structure.TabsElement;
import com.djrapitops.plugin.api.Benchmark;
import com.djrapitops.plugin.api.utility.log.ErrorLogger;
import com.djrapitops.plugin.api.utility.log.Log;
@@ -28,6 +37,7 @@ import java.lang.management.ManagementFactory;
import java.lang.management.RuntimeMXBean;
import java.nio.charset.Charset;
import java.util.*;
+import java.util.function.Supplier;
/**
* WebServer response for /debug-page used for easing issue reporting.
@@ -39,27 +49,132 @@ public class DebugPageResponse extends ErrorResponse {
public DebugPageResponse() {
super.setHeader("HTTP/1.1 200 OK");
super.setTitle(Icon.called("bug") + " Debug Information");
- super.setParagraph(buildParagraph());
+ super.setParagraph(buildContent());
replacePlaceholders();
}
- private String buildParagraph() {
- StringBuilder content = new StringBuilder();
+ private String buildContent() {
+ StringBuilder preContent = new StringBuilder();
String issueLink = Html.LINK_EXTERNAL.parse("https://github.com/Rsl1122/Plan-PlayerAnalytics/issues/new", "Create new issue on Github");
- // Information
- content.append("
")
- .append(issueLink).append("
")
- .append("This page contains debug information for an issue ticket. You can copy it directly into the issue, the info is pre-formatted.")
+ String hastebinLink = Html.LINK_EXTERNAL.parse("https://hastebin.com/", "Create a new hastebin paste");
+
+ preContent.append("
")
+ .append("This page contains debug information for an issue ticket. You can copy it directly into the issue, the info is pre-formatted.")
.append("