Fixed nickname display on Actions table, PluginData (Bans) now affect ban info

This commit is contained in:
Rsl1122 2017-12-02 15:28:39 +02:00
parent 382080aae1
commit 7e79ec02d2
8 changed files with 37 additions and 16 deletions

View File

@ -236,7 +236,7 @@ public class HealthNotes {
} else {
healthNotes.add("<p>" + Html.RED_WARN.parse() + " Total Server downtime (No Data) was "
+ FormatUtils.formatTimeAmount(serverDownTime) + "</p>");
serverHealth *= serverDownTime * 1.0 / TimeAmount.MONTH.ms();
serverHealth *= (TimeAmount.MONTH.ms() - serverDownTime) * 1.0 / TimeAmount.MONTH.ms();
}
}

View File

@ -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<BanData> banPlugins = plugin.getHookHandler().getAdditionalDataSources().stream()
.filter(p -> p instanceof BanData)
.map(p -> (BanData) p)
.collect(Collectors.toList());
Set<UUID> banned = new HashSet<>();
for (BanData banPlugin : banPlugins) {
Set<UUID> 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);

View File

@ -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) {

View File

@ -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("<a class=\"collapsed\" role=\"button\" data-toggle=\"collapse\" data-parent=\"#session_accordion\" ")
.append("href=\"#session_").append(htmlID).append("\" aria-expanded=\"false\" ")
.append("aria-controls=\"session_").append(htmlID).append("\">")
.append(dotSeparated).append("<span class=\"pull-right\">").append(dotSeparated2).append("</span>") // Title (header)
.append(dotSeparated).append("<span class=\"pull-right\">").append(sessionEnd).append("</span>") // Title (header)
.append("</a></h4>") // Closes collapsed, panel title
.append("</div>"); // Closes panel heading

View File

@ -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++;

View File

@ -5,6 +5,7 @@
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<UUID, List<String>> 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));
}
}
}

View File

@ -433,7 +433,7 @@
</div>
</div>
<div class="body">
<div id="worldPie" style="height: 400px;" class="dashboard-donut-chart"></div>
<div id="worldPie" style="height: 340px;" class="dashboard-donut-chart"></div>
</div>
</div>
<!-- #END# World Pie -->

View File

@ -653,7 +653,7 @@
</div>
</div>
<div class="body">
<div id="worldPie" style="height: 400px;" class="dashboard-donut-chart"></div>
<div id="worldPie" style="height: 340px;" class="dashboard-donut-chart"></div>
</div>
</div>
</div>