From 89b4358d12cafda979230c98f02ca29d361df336 Mon Sep 17 00:00:00 2001 From: Rsl1122 Date: Mon, 27 Nov 2017 17:00:29 +0200 Subject: [PATCH] Max height for General plugin tab elements, softdepend new PluginData --- .../plan/systems/webserver/APIRequestHandler.java | 11 ++++++++--- .../plan/systems/webserver/RequestHandler.java | 12 ++++++++---- .../structure/AnalysisPluginsTabContentCreator.java | 6 +++--- Plan/src/main/resources/plugin.yml | 5 ++++- 4 files changed, 23 insertions(+), 11 deletions(-) diff --git a/Plan/src/main/java/com/djrapitops/plan/systems/webserver/APIRequestHandler.java b/Plan/src/main/java/com/djrapitops/plan/systems/webserver/APIRequestHandler.java index 65357bd67..b9302786c 100644 --- a/Plan/src/main/java/com/djrapitops/plan/systems/webserver/APIRequestHandler.java +++ b/Plan/src/main/java/com/djrapitops/plan/systems/webserver/APIRequestHandler.java @@ -4,6 +4,7 @@ */ package main.java.com.djrapitops.plan.systems.webserver; +import com.djrapitops.plugin.api.Benchmark; import com.djrapitops.plugin.api.utility.log.Log; import com.sun.net.httpserver.Headers; import com.sun.net.httpserver.HttpExchange; @@ -31,11 +32,12 @@ public class APIRequestHandler implements HttpHandler { public void handle(HttpExchange exchange) throws IOException { Headers responseHeaders = exchange.getResponseHeaders(); Request request = new Request(exchange); + String requestString = request.toString(); + Benchmark.start("", requestString); + int responseCode = -1; try { Response response = responseHandler.getAPIResponse(request); - if (Settings.DEV_MODE.isTrue()) { - Log.debug(request.toString() + " Response code: " + response.getCode()); - } + responseCode = response.getCode(); response.setResponseHeaders(responseHeaders); response.send(exchange); } catch (Exception e) { @@ -44,6 +46,9 @@ public class APIRequestHandler implements HttpHandler { } } finally { exchange.close(); + if (Settings.DEV_MODE.isTrue()) { + Log.debug(requestString + " Response code: " + responseCode + " took " + Benchmark.stop("", requestString) + " ms"); + } } } diff --git a/Plan/src/main/java/com/djrapitops/plan/systems/webserver/RequestHandler.java b/Plan/src/main/java/com/djrapitops/plan/systems/webserver/RequestHandler.java index 4e2bb2c87..6aae85b93 100644 --- a/Plan/src/main/java/com/djrapitops/plan/systems/webserver/RequestHandler.java +++ b/Plan/src/main/java/com/djrapitops/plan/systems/webserver/RequestHandler.java @@ -4,6 +4,7 @@ */ package main.java.com.djrapitops.plan.systems.webserver; +import com.djrapitops.plugin.api.Benchmark; import com.djrapitops.plugin.api.utility.log.Log; import com.sun.net.httpserver.Headers; import com.sun.net.httpserver.HttpExchange; @@ -32,12 +33,12 @@ public class RequestHandler implements HttpHandler { public void handle(HttpExchange exchange) throws IOException { Headers responseHeaders = exchange.getResponseHeaders(); Request request = new Request(exchange); - + String requestString = request.toString(); + Benchmark.start("", requestString); + int responseCode = -1; try { Response response = responseHandler.getResponse(request); - if (Settings.DEV_MODE.isTrue()) { - Log.debug(request.toString() + " Response code: " + response.getCode()); - } + responseCode = response.getCode(); if (response instanceof PromptAuthorizationResponse) { responseHeaders.set("WWW-Authenticate", "Basic realm=\"/\";"); } @@ -49,6 +50,9 @@ public class RequestHandler implements HttpHandler { } } finally { exchange.close(); + if (Settings.DEV_MODE.isTrue()) { + Log.debug(requestString + " Response code: " + responseCode+" took "+Benchmark.stop("", requestString)+" ms"); + } } } diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/html/structure/AnalysisPluginsTabContentCreator.java b/Plan/src/main/java/com/djrapitops/plan/utilities/html/structure/AnalysisPluginsTabContentCreator.java index 36aa2c248..b1d6c967b 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/html/structure/AnalysisPluginsTabContentCreator.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/html/structure/AnalysisPluginsTabContentCreator.java @@ -87,7 +87,7 @@ public class AnalysisPluginsTabContentCreator { } public static void appendThird(PluginData pluginData, InspectContainer container, StringBuilder generalTab) { - generalTab.append("
" + + generalTab.append("
" + "
" + "
" + "

") @@ -98,7 +98,7 @@ public class AnalysisPluginsTabContentCreator { } private static void appendTwoThirds(PluginData pluginData, AnalysisContainer container, StringBuilder generalTab) { - generalTab.append("
" + + generalTab.append("
" + "
" + "
" + "

") @@ -109,7 +109,7 @@ public class AnalysisPluginsTabContentCreator { } private static void appendWhole(PluginData pluginData, AnalysisContainer container, StringBuilder generalTab) { - generalTab.append("
" + + generalTab.append("
" + "
" + "
" + "

") diff --git a/Plan/src/main/resources/plugin.yml b/Plan/src/main/resources/plugin.yml index 1123809aa..db57c4e9a 100644 --- a/Plan/src/main/resources/plugin.yml +++ b/Plan/src/main/resources/plugin.yml @@ -3,7 +3,6 @@ author: Rsl1122 main: main.java.com.djrapitops.plan.Plan version: 4.1.0 softdepend: -- OnTime - EssentialsX - Towny - Vault @@ -16,6 +15,10 @@ softdepend: - LiteBans - SuperbVote - ViaVersion +- BanManager +- ProtocolSupport +- Kingdoms +- RedProtect commands: plan: