[2.8.0] Added gm chart back, minor fixes to html

This commit is contained in:
Rsl1122 2017-03-06 11:40:07 +02:00
parent 1abdc26a11
commit d6fe6af5a0
5 changed files with 114 additions and 81 deletions

View File

@ -45,7 +45,8 @@ public enum Html {
TOTAL_VOTES("<p>Players have voted total of " + REPLACE0 + " times.</p>"),
PLOT_OPTIONS("<p>Plot options: " + REPLACE0 + "</p>"),
FRIENDS("<p>Friends with " + REPLACE0 + "</p>"),
BALANCE("<p>Balance: " + REPLACE0 + "</p>"), BANNED("| " + SPAN.parse(COLOR_4.parse() + "Banned")),
BALANCE("<p>Balance: " + REPLACE0 + "</p>"),
BANNED("| " + SPAN.parse(COLOR_4.parse() + "Banned")),
OPERATOR(", Operator (Op)"),
ONLINE("| " + SPAN.parse(COLOR_2.parse() + "Online")),
OFFLINE("| " + SPAN.parse(COLOR_4.parse() + "Offline")),

View File

@ -44,7 +44,7 @@ public class PlaceholderUtils {
replaceMap.put("%npweek%", data.getNewPlayersWeek() + "");
replaceMap.put("%npmonth%", data.getNewPlayersMonth() + "");
replaceMap.put("%commanduse%", HtmlUtils.removeXSS(data.getCommandUseListHtml()));
replaceMap.put("%totalcommands%", data.getTotalCommands()+"");
replaceMap.put("%totalcommands%", data.getTotalCommands() + "");
replaceMap.put("%avgage%", (data.getAverageAge() != -1) ? "" + data.getAverageAge() : Phrase.DEM_UNKNOWN + "");
replaceMap.put("%avgplaytime%", FormatUtils.formatTimeAmount("" + data.getAveragePlayTime()));
replaceMap.put("%totalplaytime%", FormatUtils.formatTimeAmount("" + data.getTotalPlayTime()));
@ -75,18 +75,18 @@ public class PlaceholderUtils {
"\"" + Html.GRAPH_BANNED.parse() + "\""
};
replaceMap.put("%labelsactivity%", Arrays.toString(activityLabels));
String[] activityData = new String[]{data.getActive() + "", data.getInactive() + "", data.getJoinleaver()+ "", data.getBanned() + ""};
String[] activityData = new String[]{data.getActive() + "", data.getInactive() + "", data.getJoinleaver() + "", data.getBanned() + ""};
replaceMap.put("%activitydata%", Arrays.toString(activityData));
replaceMap.put("%activitycolors%", "\"#" + Settings.HCOLOR_ACTP_ACT
+ "\",\"#" + Settings.HCOLOR_ACTP_INA + "\",\"#" + Settings.HCOLOR_ACTP_JON + "\",\"#" + Settings.HCOLOR_ACTP_BAN + "\"");
replaceMap.put("%activecol%", Settings.HCOLOR_ACTP_ACT+"");
replaceMap.put("%inactivecol%", Settings.HCOLOR_ACTP_INA+"");
replaceMap.put("%joinleavecol%", Settings.HCOLOR_ACTP_JON+"");
replaceMap.put("%bancol%", Settings.HCOLOR_ACTP_BAN+"");
replaceMap.put("%gm0col%", Settings.HCOLOR_GMP_0+"");
replaceMap.put("%gm1col%", Settings.HCOLOR_GMP_1+"");
replaceMap.put("%gm2col%", Settings.HCOLOR_GMP_2+"");
replaceMap.put("%gm3col%", Settings.HCOLOR_GMP_3+"");
replaceMap.put("%activecol%", Settings.HCOLOR_ACTP_ACT + "");
replaceMap.put("%inactivecol%", Settings.HCOLOR_ACTP_INA + "");
replaceMap.put("%joinleavecol%", Settings.HCOLOR_ACTP_JON + "");
replaceMap.put("%bancol%", Settings.HCOLOR_ACTP_BAN + "");
replaceMap.put("%gm0col%", Settings.HCOLOR_GMP_0 + "");
replaceMap.put("%gm1col%", Settings.HCOLOR_GMP_1 + "");
replaceMap.put("%gm2col%", Settings.HCOLOR_GMP_2 + "");
replaceMap.put("%gm3col%", Settings.HCOLOR_GMP_3 + "");
String[] gmData = new String[]{
(data.getGm0Perc() * 100) + "",
(data.getGm1Perc() * 100) + "",
@ -98,7 +98,7 @@ public class PlaceholderUtils {
replaceMap.put("%gmcolors%", "\"#" + Settings.HCOLOR_GMP_0 + "\",\"#" + Settings.HCOLOR_GMP_1
+ "\",\"#" + Settings.HCOLOR_GMP_2 + "\",\"#" + Settings.HCOLOR_GMP_3 + "\"");
replaceMap.putAll(plugin.getHookHandler().getAdditionalAnalysisReplaceRules());
replaceMap.put("%sessionaverage%", FormatUtils.formatTimeAmount(data.getSessionAverage()+""));
replaceMap.put("%sessionaverage%", FormatUtils.formatTimeAmount(data.getSessionAverage() + ""));
return replaceMap;
}
@ -144,6 +144,10 @@ public class PlaceholderUtils {
replaceMap.put("%gm1%", FormatUtils.formatTimeAmount("" + gmData[1]));
replaceMap.put("%gm2%", FormatUtils.formatTimeAmount("" + gmData[2]));
replaceMap.put("%gm3%", FormatUtils.formatTimeAmount("" + gmData[3]));
replaceMap.put("%gmdata%", Arrays.toString(gmData));
replaceMap.put("%gmlabels%", "[\"Survival\", \"Creative\", \"Adventure\", \"Spectator\"]");
replaceMap.put("%gmcolors%", "\"#" + Settings.HCOLOR_GMP_0 + "\",\"#" + Settings.HCOLOR_GMP_1
+ "\",\"#" + Settings.HCOLOR_GMP_2 + "\",\"#" + Settings.HCOLOR_GMP_3 + "\"");
replaceMap.put("%gmtotal%", FormatUtils.formatTimeAmount("" + total));
replaceMap.put("%ips%", (showIPandUUID ? data.getIps().toString() : Html.HIDDEN.parse()));
replaceMap.put("%nicknames%", HtmlUtils.removeXSS(FormatUtils.swapColorsToSpan(data.getNicknames().toString())));
@ -159,20 +163,20 @@ public class PlaceholderUtils {
replaceMap.put("%playerkills%", data.getPlayerKills().size() + "");
replaceMap.put("%mobkills%", data.getMobKills() + "");
replaceMap.put("%sessionstable%", SortableSessionTableCreator.createSortedSessionDataTable10(data.getSessions()));
replaceMap.put("%sessionaverage%", FormatUtils.formatTimeAmount(AnalysisUtils.average(AnalysisUtils.transformSessionDataToLengths(data.getSessions()))+""));
replaceMap.put("%sessionaverage%", FormatUtils.formatTimeAmount(AnalysisUtils.average(AnalysisUtils.transformSessionDataToLengths(data.getSessions())) + ""));
replaceMap.put("%killstable%", SortableKillsTableCreator.createSortedSessionDataTable10(data.getPlayerKills()));
Plan plugin = getPlugin(Plan.class);
replaceMap.put("%version%", plugin.getDescription().getVersion());
replaceMap.put("%planlite%", "");
String[] playersDataArray = PlayerActivityGraphCreator.generateDataArray(data.getSessions(), (long) 604800 * 1000);
replaceMap.put("%dataweek%", playersDataArray[0].replace(plugin.getHandler().getMaxPlayers()+"]", "2]"));
replaceMap.put("%dataweek%", playersDataArray[0].replace(plugin.getHandler().getMaxPlayers() + "]", "2]"));
replaceMap.put("%labelsweek%", playersDataArray[1]);
replaceMap.put("%playersgraphcolor%", Settings.HCOLOR_ACT_ONL + "");
replaceMap.put("%playersgraphfill%", Settings.HCOLOR_ACT_ONL_FILL + "");
replaceMap.put("%gm0col%", Settings.HCOLOR_GMP_0+"");
replaceMap.put("%gm1col%", Settings.HCOLOR_GMP_1+"");
replaceMap.put("%gm2col%", Settings.HCOLOR_GMP_2+"");
replaceMap.put("%gm3col%", Settings.HCOLOR_GMP_3+"");
replaceMap.put("%gm0col%", Settings.HCOLOR_GMP_0 + "");
replaceMap.put("%gm1col%", Settings.HCOLOR_GMP_1 + "");
replaceMap.put("%gm2col%", Settings.HCOLOR_GMP_2 + "");
replaceMap.put("%gm3col%", Settings.HCOLOR_GMP_3 + "");
replaceMap.put("%inaccuratedatawarning%", (new Date().getTime() - data.getRegistered() < 180000) ? Html.WARN_INACCURATE.parse() : "");
replaceMap.putAll(plugin.getHookHandler().getAdditionalInspectReplaceRules(uuid));
return replaceMap;

View File

@ -481,13 +481,13 @@
<table class="sortable table">
<thead>
<tr>
<th>Player</th>
<th>Active</th>
<th>Playtime</th>
<th>Login times</th>
<th>Registered</th>
<th>Last seen</th>
<th>Geolocation</th>
<th><i class="fa fa-user" aria-hidden="true"></i> Player</th>
<th><i class="fa fa-check" aria-hidden="true"></i> Active</th>
<th><i class="fa fa-clock-o" aria-hidden="true"></i> Playtime</th>
<th><i class="fa fa-calendar-plus-o" aria-hidden="true"></i> Login times</th>
<th><i class="fa fa-user-plus" aria-hidden="true"></i> Registered</th>
<th><i class="fa fa-calendar-check-o" aria-hidden="true"></i> Last seen</th>
<th><i class="fa fa-globe" aria-hidden="true"></i> Geolocation</th>
</tr>
</thead>
<tbody>
@ -517,8 +517,8 @@
<table class="sortable table">
<thead>
<tr>
<th>Command</th>
<th>Times used</th>
<th><i class="fa fa-chevron-right" aria-hidden="true"></i> Command</th>
<th><i class="fa fa-list-ol" aria-hidden="true"></i> Times used</th>
</tr>
</thead>
<tbody>

View File

@ -174,7 +174,7 @@
<header>
<img style="float: right; padding: 5px" src="http://puu.sh/tJZUb/c2e0ab220f.png" alt="Player Analytics | Inspect %name%">
<p style="float: right; text-align: right;">Player Analytics v.%version%</p>
<h1>Plan | Inspect Player %name%</h1>
<h1>Plan | Inspect Player %name%%op%</h1>
<h4>Has Connected from ips: %ips%</h4>
</header>
%inaccuratedatawarning%
@ -204,11 +204,11 @@
</div>
</div>
<img style="float: right; padding: 5px" alt="%name%" src="http://cravatar.eu/head/%name%/128.png">
<p><i class="fa fa-user" aria-hidden="true"></i> %active% %isonline% %essentials% %banned%%op%<br/>
<p><i class="fa fa-user" aria-hidden="true"></i> %active% %isonline%%banned% %essentials%<br/>
<i class="fa fa-address-card-o" aria-hidden="true"></i> Nicknames: %nicknames%<br/>
<i class="fa fa-clock-o" aria-hidden="true"></i> Playtime: %playtime%<br/>
<i class="fa fa-calendar-plus-o" aria-hidden="true"></i> Login times %logintimes%<br/>
<i class="fa fa-gavel" aria-hidden="true"></i> Times kicked %timeskicked%<br/>
<i class="fa fa-calendar-plus-o" aria-hidden="true"></i> Login times: %logintimes%<br/>
<i class="fa fa-gavel" aria-hidden="true"></i> Times kicked: %timeskicked%<br/>
<i class="fa fa-crosshairs" aria-hidden="true"></i> Player kills: %playerkills% | <i class="fa fa-crosshairs" aria-hidden="true"></i> Mob kills: %mobkills% | <i class="fa fa-meh-o" aria-hidden="true"></i> Deaths: %deaths%<br/>
<br/>
<i class="fa fa-globe" aria-hidden="true"></i> Geolocation: %geoloc%<br/>
@ -233,58 +233,63 @@
</div>
</div>
</div>
<div class="box-area">
<div class="infobox" style="background-color: #%gm0col%; width: 23%;">
<div class="info-icon">
<i class="fa fa-fire" aria-hidden="true"></i>
</div>
<div class="info-text">
<div class="info-number">
%gm0%
<div>
<div class="box-area">
<div class="infobox" style="background-color: #%gm0col%; width: 23%;">
<div class="info-icon">
<i class="fa fa-fire" aria-hidden="true"></i>
</div>
<div class="info-label">
Survival
<div class="info-text">
<div class="info-number">
%gm0%
</div>
<div class="info-label">
Survival
</div>
</div>
</div>
<div class="infobox" style="background-color: #%gm1col%; width: 23%;">
<div class="info-icon">
<i class="fa fa-cube" aria-hidden="true"></i>
</div>
<div class="info-text">
<div class="info-number">
%gm1%
</div>
<div class="info-label">
Creative
</div>
</div>
</div>
<div class="infobox" style="background-color: #%gm2col%; width: 23%;">
<div class="info-icon">
<i class="fa fa-chevron-right" aria-hidden="true"></i>
</div>
<div class="info-text">
<div class="info-number">
%gm2%
</div>
<div class="info-label">
Adventure
</div>
</div>
</div>
<div class="infobox" style="background-color: #%gm3col%; width: 23%;">
<div class="info-icon">
<i class="fa fa-binoculars" aria-hidden="true"></i>
</div>
<div class="info-text">
<div class="info-number">
%gm3%
</div>
<div class="info-label">
Spectator
</div>
</div>
</div>
</div>
<div class="infobox" style="background-color: #%gm1col%; width: 23%;">
<div class="info-icon">
<i class="fa fa-cube" aria-hidden="true"></i>
</div>
<div class="info-text">
<div class="info-number">
%gm1%
</div>
<div class="info-label">
Creative
</div>
</div>
</div>
<div class="infobox" style="background-color: #%gm2col%; width: 23%;">
<div class="info-icon">
<i class="fa fa-chevron-right" aria-hidden="true"></i>
</div>
<div class="info-text">
<div class="info-number">
%gm2%
</div>
<div class="info-label">
Adventure
</div>
</div>
</div>
<div class="infobox" style="background-color: #%gm3col%; width: 23%;">
<div class="info-icon">
<i class="fa fa-binoculars" aria-hidden="true"></i>
</div>
<div class="info-text">
<div class="info-number">
%gm3%
</div>
<div class="info-label">
Spectator
</div>
</div>
<div class="column info">
<canvas id="gmPie" width="1000" height="600" style="width: 95%;"></canvas>
</div>
</div>
</div>
@ -356,6 +361,29 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.5.0/Chart.js"></script>
<script>
// Script for All charts using Chart.js
var ctxgmpie = document.getElementById("gmPie");
var dataGmPie = {
labels: %gmlabels% ,
datasets: [
{
data: %gmdata% ,
backgroundColor: [ %gmcolors% ],
hoverBackgroundColor: [ %gmcolors% ]
}
]
}
var GMPie = new Chart(ctxgmpie, {
type: 'doughnut',
data: dataGmPie,
options: {
legend: {
position: 'right',
labels: {
padding: 7
}
}
}
});
var ctxweek = document.getElementById("playerChartWeek");
var dataweek = {
labels: %labelsweek% ,

View File

@ -1,7 +1,7 @@
name: Plan
author: Rsl1122
main: main.java.com.djrapitops.plan.Plan
version: 2.7.3
version: 2.8.0
softdepend:
- OnTime