[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>"), TOTAL_VOTES("<p>Players have voted total of " + REPLACE0 + " times.</p>"),
PLOT_OPTIONS("<p>Plot options: " + REPLACE0 + "</p>"), PLOT_OPTIONS("<p>Plot options: " + REPLACE0 + "</p>"),
FRIENDS("<p>Friends with " + 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)"), OPERATOR(", Operator (Op)"),
ONLINE("| " + SPAN.parse(COLOR_2.parse() + "Online")), ONLINE("| " + SPAN.parse(COLOR_2.parse() + "Online")),
OFFLINE("| " + SPAN.parse(COLOR_4.parse() + "Offline")), OFFLINE("| " + SPAN.parse(COLOR_4.parse() + "Offline")),

View File

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

View File

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

View File

@ -174,7 +174,7 @@
<header> <header>
<img style="float: right; padding: 5px" src="http://puu.sh/tJZUb/c2e0ab220f.png" alt="Player Analytics | Inspect %name%"> <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> <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> <h4>Has Connected from ips: %ips%</h4>
</header> </header>
%inaccuratedatawarning% %inaccuratedatawarning%
@ -204,11 +204,11 @@
</div> </div>
</div> </div>
<img style="float: right; padding: 5px" alt="%name%" src="http://cravatar.eu/head/%name%/128.png"> <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-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-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-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-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/> <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/> <br/>
<i class="fa fa-globe" aria-hidden="true"></i> Geolocation: %geoloc%<br/> <i class="fa fa-globe" aria-hidden="true"></i> Geolocation: %geoloc%<br/>
@ -233,6 +233,7 @@
</div> </div>
</div> </div>
</div> </div>
<div>
<div class="box-area"> <div class="box-area">
<div class="infobox" style="background-color: #%gm0col%; width: 23%;"> <div class="infobox" style="background-color: #%gm0col%; width: 23%;">
<div class="info-icon"> <div class="info-icon">
@ -287,6 +288,10 @@
</div> </div>
</div> </div>
</div> </div>
<div class="column info">
<canvas id="gmPie" width="1000" height="600" style="width: 95%;"></canvas>
</div>
</div>
</div> </div>
<div class="column graphs"> <div class="column graphs">
<div class="headerbox"> <div class="headerbox">
@ -356,6 +361,29 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.5.0/Chart.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.5.0/Chart.js"></script>
<script> <script>
// Script for All charts using Chart.js // 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 ctxweek = document.getElementById("playerChartWeek");
var dataweek = { var dataweek = {
labels: %labelsweek% , labels: %labelsweek% ,

View File

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