From 41d148fc4c6edfac4787a4f08ddf006290ea7e63 Mon Sep 17 00:00:00 2001 From: Rsl1122 Date: Tue, 31 Oct 2017 19:59:43 +0200 Subject: [PATCH] Fixed odd Html issues on Bungee systems #383 #380 --- .../systems/webserver/webapi/bungee/PostHtmlWebAPI.java | 8 ++++++-- .../plan/utilities/html/graphs/WorldPieCreator.java | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Plan/src/main/java/com/djrapitops/plan/systems/webserver/webapi/bungee/PostHtmlWebAPI.java b/Plan/src/main/java/com/djrapitops/plan/systems/webserver/webapi/bungee/PostHtmlWebAPI.java index 6ae6b35f6..8b0319aaf 100644 --- a/Plan/src/main/java/com/djrapitops/plan/systems/webserver/webapi/bungee/PostHtmlWebAPI.java +++ b/Plan/src/main/java/com/djrapitops/plan/systems/webserver/webapi/bungee/PostHtmlWebAPI.java @@ -29,7 +29,11 @@ public class PostHtmlWebAPI extends WebAPI { @Override public Response onRequest(IPlan plugin, Map variables) { try { - String html = variables.get("html"); + String htmlVariable = variables.get("html"); + if (htmlVariable == null) { + return badRequest("Html was null"); + } + String html = "" + htmlVariable.split("", 2)[1]; String target = variables.get("target"); InformationManager infoManager = plugin.getInfoManager(); switch (target) { @@ -60,8 +64,8 @@ public class PostHtmlWebAPI extends WebAPI { public void sendInspectHtml(String address, UUID uuid, String html) throws WebAPIException { addVariable("uuid", uuid.toString()); - addVariable("html", html); addVariable("target", "inspectPage"); + addVariable("html", html); super.sendRequest(address); } diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/html/graphs/WorldPieCreator.java b/Plan/src/main/java/com/djrapitops/plan/utilities/html/graphs/WorldPieCreator.java index 6af500bae..7534416f0 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/html/graphs/WorldPieCreator.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/html/graphs/WorldPieCreator.java @@ -54,6 +54,7 @@ public class WorldPieCreator { } private static Map transformToAliases(Map playtimePerWorld) { + // TODO Optimization is possible WorldAliasSettings aliasSettings = new WorldAliasSettings(Plan.getInstance()); Map aliases = aliasSettings.getAliases(); @@ -104,6 +105,7 @@ public class WorldPieCreator { } private static Map transformToGMAliases(Map gmTimesMap) { + // TODO Optimization is possible WorldAliasSettings aliasSettings = new WorldAliasSettings(Plan.getInstance()); Map aliases = aliasSettings.getAliases();