diff --git a/Plan/src/main/java/com/djrapitops/plan/data/element/HealthNotes.java b/Plan/src/main/java/com/djrapitops/plan/data/element/HealthNotes.java index 5d1c36e78..a4a534b1d 100644 --- a/Plan/src/main/java/com/djrapitops/plan/data/element/HealthNotes.java +++ b/Plan/src/main/java/com/djrapitops/plan/data/element/HealthNotes.java @@ -236,7 +236,7 @@ public class HealthNotes { } else { healthNotes.add("

" + Html.RED_WARN.parse() + " Total Server downtime (No Data) was " + FormatUtils.formatTimeAmount(serverDownTime) + "

"); - serverHealth *= serverDownTime * 1.0 / TimeAmount.MONTH.ms(); + serverHealth *= (TimeAmount.MONTH.ms() - serverDownTime) * 1.0 / TimeAmount.MONTH.ms(); } } diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/analysis/Analysis.java b/Plan/src/main/java/com/djrapitops/plan/utilities/analysis/Analysis.java index f8c9316f0..be0e3b5c6 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/analysis/Analysis.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/analysis/Analysis.java @@ -10,6 +10,7 @@ import main.java.com.djrapitops.plan.data.AnalysisData; import main.java.com.djrapitops.plan.data.PlayerProfile; import main.java.com.djrapitops.plan.data.ServerProfile; import main.java.com.djrapitops.plan.data.element.AnalysisContainer; +import main.java.com.djrapitops.plan.data.plugin.BanData; import main.java.com.djrapitops.plan.data.plugin.PluginData; import main.java.com.djrapitops.plan.database.Database; import main.java.com.djrapitops.plan.settings.Settings; @@ -23,6 +24,7 @@ import main.java.com.djrapitops.plan.systems.webserver.response.ErrorResponse; import main.java.com.djrapitops.plan.systems.webserver.response.InternalErrorResponse; import java.util.*; +import java.util.stream.Collectors; /** * @author Rsl1122 @@ -115,13 +117,11 @@ public class Analysis { serverProfile = profile; for (PlayerProfile player : profile.getPlayers()) { - dataCache.updateNames(player.getUuid(), player.getName(), null); } long fetchPhaseLength = Benchmark.stop("Analysis", "Fetch Phase"); - - // TODO BanData (PluginData) effects + setBannedByPlugins(profile); Benchmark.start("Analysis Phase"); Log.logDebug("Analysis", "Analysis Phase"); @@ -150,6 +150,23 @@ public class Analysis { return true; } + private void setBannedByPlugins(ServerProfile profile) { + UUID serverUUID = Plan.getServerUUID(); + List banPlugins = plugin.getHookHandler().getAdditionalDataSources().stream() + .filter(p -> p instanceof BanData) + .map(p -> (BanData) p) + .collect(Collectors.toList()); + + Set banned = new HashSet<>(); + for (BanData banPlugin : banPlugins) { + Set uuids = profile.getUuids(); + banned.addAll(banPlugin.filterBanned(uuids)); + } + + profile.getPlayers().stream().filter(player -> banned.contains(player.getUuid())) + .forEach(player -> player.bannedOnServer(serverUUID)); + } + private void log(String msg) { if (Settings.ANALYSIS_LOG.isTrue()) { Log.info(msg); diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/html/HtmlUtils.java b/Plan/src/main/java/com/djrapitops/plan/utilities/html/HtmlUtils.java index 8e3badfac..920d2d909 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/html/HtmlUtils.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/html/HtmlUtils.java @@ -92,7 +92,7 @@ public class HtmlUtils { string = Html.SPAN.parse(string); } - return string.replace("§r", ""); + return string.replace("§r", "").replace("§l", "").replace("§m", "").replace("§n", "").replace("§o", "").replace("§k", ""); } public static String separateWithQuotes(String... strings) { diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/html/structure/SessionTabStructureCreator.java b/Plan/src/main/java/com/djrapitops/plan/utilities/html/structure/SessionTabStructureCreator.java index 08a49d5ce..e4ef71657 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/html/structure/SessionTabStructureCreator.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/html/structure/SessionTabStructureCreator.java @@ -71,12 +71,14 @@ public class SessionTabStructureCreator { String name = Plan.getInstance().getDataCache().getName(uuid); String link = Plan.getPlanAPI().getPlayerInspectPageLink(name); - String dotSeparated = appendName ? - HtmlStructure.separateWithDots(name, sessionStart) : - HtmlStructure.separateWithDots(serverName, sessionStart); + String dotSeparated2 = appendWorldPerc - ? HtmlStructure.separateWithDots(SessionsTableCreator.getLongestWorldPlayed(session), sessionLength) - : sessionEnd; + ? HtmlStructure.separateWithDots(sessionStart, SessionsTableCreator.getLongestWorldPlayed(session)) + : sessionStart; + String dotSeparated = appendName ? + HtmlStructure.separateWithDots(name, dotSeparated2) : + HtmlStructure.separateWithDots(serverName, dotSeparated2); + String htmlID = "" + session.getSessionStart() + sessionID + i; @@ -96,7 +98,7 @@ public class SessionTabStructureCreator { .append("") - .append(dotSeparated).append("").append(dotSeparated2).append("") // Title (header) + .append(dotSeparated).append("").append(sessionEnd).append("") // Title (header) .append("") // Closes collapsed, panel title .append(""); // Closes panel heading diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/html/tables/ActionsTableCreator.java b/Plan/src/main/java/com/djrapitops/plan/utilities/html/tables/ActionsTableCreator.java index 18cefe464..d2ae56d36 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/html/tables/ActionsTableCreator.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/html/tables/ActionsTableCreator.java @@ -7,6 +7,7 @@ package main.java.com.djrapitops.plan.utilities.html.tables; import main.java.com.djrapitops.plan.data.container.Action; import main.java.com.djrapitops.plan.utilities.FormatUtils; import main.java.com.djrapitops.plan.utilities.html.Html; +import main.java.com.djrapitops.plan.utilities.html.HtmlUtils; import java.util.List; @@ -38,7 +39,7 @@ public class ActionsTableCreator { html.append(Html.TABLELINE_3_CUSTOMKEY_1.parse( String.valueOf(date), FormatUtils.formatTimeStampYear(date), action.getDoneAction().toString(), - action.getAdditionalInfo() + HtmlUtils.swapColorsToSpan(action.getAdditionalInfo()) )); i++; diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/html/tables/NicknameTableCreator.java b/Plan/src/main/java/com/djrapitops/plan/utilities/html/tables/NicknameTableCreator.java index 9917256a3..fd5c9fb0f 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/html/tables/NicknameTableCreator.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/html/tables/NicknameTableCreator.java @@ -1,10 +1,11 @@ -/* +/* * Licence is provided in the jar as license.yml also here: * https://github.com/Rsl1122/Plan-PlayerAnalytics/blob/master/Plan/src/main/resources/license.yml */ package main.java.com.djrapitops.plan.utilities.html.tables; import main.java.com.djrapitops.plan.utilities.html.Html; +import main.java.com.djrapitops.plan.utilities.html.HtmlUtils; import java.util.List; import java.util.Map; @@ -30,7 +31,7 @@ public class NicknameTableCreator { for (Map.Entry> entry : nicknames.entrySet()) { String serverName = serverNames.getOrDefault(entry.getKey(), "Unknown"); for (String nick : entry.getValue()) { - html.append(Html.TABLELINE_2.parse(nick, serverName)); + html.append(Html.TABLELINE_2.parse(HtmlUtils.swapColorsToSpan(HtmlUtils.removeXSS(nick)), serverName)); } } } diff --git a/Plan/src/main/resources/web/player.html b/Plan/src/main/resources/web/player.html index a2c4dcad3..307c68b90 100644 --- a/Plan/src/main/resources/web/player.html +++ b/Plan/src/main/resources/web/player.html @@ -433,7 +433,7 @@
-
+
diff --git a/Plan/src/main/resources/web/server.html b/Plan/src/main/resources/web/server.html index 5b438718f..adfcdf71d 100644 --- a/Plan/src/main/resources/web/server.html +++ b/Plan/src/main/resources/web/server.html @@ -653,7 +653,7 @@
-
+