mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-11-01 00:10:12 +01:00
Revert "Html improvements, Html Enum, JHeatmap removed, bugfixes"
This reverts commit 54cea31618
.
This commit is contained in:
parent
54cea31618
commit
f91079cede
@ -30,6 +30,12 @@
|
||||
<version>1.3</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.javaheatmap</groupId>
|
||||
<artifactId>jheatchart</artifactId>
|
||||
<version>0.6</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<defaultGoal>clean package install</defaultGoal>
|
||||
|
@ -8,20 +8,17 @@ import static org.bukkit.plugin.java.JavaPlugin.getPlugin;
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public enum Phrase {
|
||||
REPLACE0("REPLACE0"),
|
||||
PREFIX("[Plan] "),
|
||||
ENABLED("Player Analytics Enabled."),
|
||||
DISABLED("Player Analytics Disabled."),
|
||||
SAVE_CACHE("Saving cached data.."),
|
||||
ADD_TO_CACHE("Added REPLACE0 to Cache."),
|
||||
ADD_TO_CACHE("Added #1 to Cache."),
|
||||
CONFIG_HEADER("Plan Config | More info at https://www.spigotmc.org/wiki/plan-configuration/"),
|
||||
DB_INIT("Database init.."),
|
||||
DB_ESTABLISHED(REPLACE0 + "-database connection established."),
|
||||
DATABASE_TYPE_DOES_NOT_EXIST("That database type doesn't exist."),
|
||||
DATABASE_FAILURE_DISABLE("Database initialization has failed, disabling Plan."),
|
||||
NOTIFY_EMPTY_IP(ChatColor.YELLOW+""+PREFIX+"IP in server.properties is empty & AlternativeServerIP is not used, incorrect links will be given!"),
|
||||
//
|
||||
VERSION_NEW_AVAILABLE("New Version ("+REPLACE0+") is availible at https://www.spigotmc.org/resources/plan-player-analytics.32536/"),
|
||||
VERSION_NEW_AVAILABLE("New Version (#1) is availible at https://www.spigotmc.org/resources/plan-player-analytics.32536/"),
|
||||
VERSION_LATEST("You're running the latest version"),
|
||||
VERSION_CHECK_ERROR("Failed to compare versions."),
|
||||
VERSION_FAIL("Failed to get newest version number."),
|
||||
@ -86,8 +83,8 @@ public enum Phrase {
|
||||
CMD_CLICK_ME("Click Me"),
|
||||
CMD_LINK(COLOR_SEC.color() + " " + BALL + COLOR_MAIN.color() + " Link: " + COLOR_TER.color()),
|
||||
CMD_PASS_PLANLITE(ChatColor.YELLOW + "" + PREFIX + "Passing to PlanLite.."),
|
||||
CMD_RESULTS_AVAILABLE(COLOR_SEC.color() + " Results will be available for " + COLOR_TER.color() + REPLACE0 + COLOR_SEC.color() + " minutes."),
|
||||
CMD_NO_RESULTS(CMD_BALL + " No results for " + COLOR_SEC.color() + REPLACE0 + COLOR_MAIN.color() + "."),
|
||||
CMD_RESULTS_AVAILABLE(COLOR_SEC.color() + " Results will be available for " + COLOR_TER.color() + "#1" + COLOR_SEC.color() + " minutes."),
|
||||
CMD_NO_RESULTS(CMD_BALL + " No results for " + COLOR_SEC.color() + "#1" + COLOR_MAIN.color() + "."),
|
||||
CMD_MATCH(COLOR_SEC.color() + " Matching player: " + COLOR_TER.color()),
|
||||
//
|
||||
COMMAND_SENDER_NOT_PLAYER(ChatColor.RED + "" + PREFIX + "This command can be only used as a player."),
|
||||
@ -96,15 +93,15 @@ public enum Phrase {
|
||||
COMMAND_REQUIRES_ARGUMENTS_ONE(ChatColor.RED + "" + PREFIX + "Command requires one argument."),
|
||||
COMMAND_NO_PERMISSION(ChatColor.RED + "" + PREFIX + "You do not have the required permmission.");
|
||||
|
||||
private String text;
|
||||
private ChatColor color;
|
||||
private final String text;
|
||||
private final ChatColor color;
|
||||
|
||||
private Phrase(String text) {
|
||||
private Phrase(final String text) {
|
||||
this.text = text;
|
||||
this.color = null;
|
||||
}
|
||||
|
||||
private Phrase(ChatColor color) {
|
||||
private Phrase(final ChatColor color) {
|
||||
this.color = color;
|
||||
this.text = "";
|
||||
}
|
||||
@ -114,12 +111,8 @@ public enum Phrase {
|
||||
return text;
|
||||
}
|
||||
|
||||
public String parse(String... p) {
|
||||
String returnValue = this.toString();
|
||||
for (int i = 0; i < p.length; i++) {
|
||||
returnValue = returnValue.replaceAll("REPLACE" + i, p[i]);
|
||||
}
|
||||
return returnValue;
|
||||
public String parse(String replace) {
|
||||
return text.replaceAll("#1", replace);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -23,14 +23,14 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
/* TODO 2.2.0
|
||||
Placeholder API
|
||||
Immutable InspectCache ?
|
||||
Recent players 25%
|
||||
Database cleaning
|
||||
Location Analysis to view meaningful locations on Dynmap (Investigate dynmap api)
|
||||
Integrate PlanLite features to Plan and discontinue PlanLite
|
||||
Seperate serverdata and userdata saving
|
||||
Make Analysis.java readable
|
||||
Database Cleaning of useless data
|
||||
Fix any bugs that come up
|
||||
- New Players not reset if server not restarted
|
||||
PlanLite Top 20 richest 25%
|
||||
PlanLite Top 20 most votes 25%
|
||||
Top 20 most active 25%
|
||||
Clear setting multiper (InspectCache)
|
||||
Clear check for existing clear task. (InspectCache)
|
||||
*/
|
||||
/**
|
||||
*
|
||||
@ -67,9 +67,9 @@ public class Plan extends JavaPlugin {
|
||||
saveConfig();
|
||||
|
||||
log(MiscUtils.checkVersion());
|
||||
log(Phrase.DB_INIT+"");
|
||||
log("Database init..");
|
||||
if (initDatabase()) {
|
||||
log(Phrase.DB_ESTABLISHED.parse(db.getConfigName()));
|
||||
log(db.getConfigName() + "-database connection established.");
|
||||
} else {
|
||||
logError(Phrase.DATABASE_FAILURE_DISABLE.toString());
|
||||
getServer().getPluginManager().disablePlugin(this);
|
||||
|
@ -29,23 +29,23 @@ public enum Settings {
|
||||
DEM_IGNORE(getPlugin(Plan.class).getConfig().getString("Customization.DemographicsTriggers.IgnoreWhen")),
|
||||
;
|
||||
|
||||
private String text;
|
||||
private boolean bool;
|
||||
private int number;
|
||||
private final String text;
|
||||
private final boolean bool;
|
||||
private final int number;
|
||||
|
||||
private Settings(String text) {
|
||||
private Settings(final String text) {
|
||||
this.text = text;
|
||||
this.bool = false;
|
||||
this.number = -1;
|
||||
}
|
||||
|
||||
private Settings(boolean bool) {
|
||||
private Settings(final boolean bool) {
|
||||
this.bool = bool;
|
||||
this.text = "";
|
||||
this.number = -1;
|
||||
}
|
||||
|
||||
private Settings(int number) {
|
||||
private Settings(final int number) {
|
||||
this.bool = false;
|
||||
this.text = "";
|
||||
this.number = number;
|
||||
|
@ -28,7 +28,6 @@ public class ReloadCommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
|
||||
plugin.reloadConfig();
|
||||
plugin.onDisable();
|
||||
plugin.onEnable();
|
||||
sender.sendMessage(ChatColor.GREEN + "[Plan] Reload complete.");
|
||||
|
@ -1,67 +0,0 @@
|
||||
package main.java.com.djrapitops.plan.ui;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public enum Html {
|
||||
|
||||
REPLACE0("REPLACE0"),
|
||||
REPLACE1("REPLACE1"),
|
||||
WARN_INACCURATE("<div class=\"warn\">Data might be inaccurate, player has just registered.</div>"),
|
||||
COLOR_0("<span class=\"black\">"),
|
||||
COLOR_1("<span class=\"darkblue\">"),
|
||||
COLOR_2("<span class=\"darkgreen\">"),
|
||||
COLOR_3("<span class=\"darkaqua\">"),
|
||||
COLOR_4("<span class=\"darkred\">"),
|
||||
COLOR_5("<span class=\"darkpurple\">"),
|
||||
COLOR_6("<span class=\"gold\">"),
|
||||
COLOR_7("<span class=\"gray\">"),
|
||||
COLOR_8("<span class=\"darkgray\">"),
|
||||
COLOR_9("<span class=\"blue\">"),
|
||||
COLOR_a("<span class=\"green\">"),
|
||||
COLOR_b("<span class=\"aqua\">"),
|
||||
COLOR_c("<span class=\"red\">"),
|
||||
COLOR_d("<span class=\"pink\">"),
|
||||
COLOR_e("<span class=\"yellow\">"),
|
||||
COLOR_f("<span class=\"white\">"),
|
||||
SPAN(""+REPLACE0+"</span>"),
|
||||
BUTTON("<a class=\"button\" href=\""+REPLACE0+"\">"+REPLACE1+"</a>"),
|
||||
BUTTON_CLASS("class=\"button\""),
|
||||
LINK_CLASS("class=\"link\""),
|
||||
TABLE_START("<table class=\"table\">"),
|
||||
TABLE_END("</table>"),
|
||||
TABLELINE("<tr class=\"tableline\"><td><b>"+REPLACE0+"</b></td>\r\n<td>"+REPLACE1+"</td></tr>"),
|
||||
ERROR_TABLE("<p class=\"red\">Error Calcuclating Table (No data)</p>"),
|
||||
IMG("<img src=\""+REPLACE0+"\">"),
|
||||
TOP_TOWNS("<p><b>Top 20 Towns</b></p>"),
|
||||
TOP_FACTIONS("<p><b>Top 20 Factions</b></p>"),
|
||||
TOTAL_BALANCE("<p>Server Total Balance: "+REPLACE0+"</p>"),
|
||||
TOTAL_VOTES("<p>Players have voted total of "+REPLACE0+" times.</p>"),
|
||||
TOWN("<p>Town: "+REPLACE0+"</p>"),
|
||||
PLOT_OPTIONS("<p>Plot options: "+REPLACE0+"</p>"),
|
||||
FRIENDS("<p>Friends with "+REPLACE0+"</p>"),
|
||||
FACTION("<p>Faction: " + REPLACE0 + "</p>"),
|
||||
BALANCE("<p>Balance: " + REPLACE0 + "</p>"),
|
||||
VOTES("<p>Player has voted " + REPLACE0 + " times.</p>")
|
||||
;
|
||||
|
||||
private final String html;
|
||||
|
||||
private Html(String html) {
|
||||
this.html = html;
|
||||
}
|
||||
|
||||
public String parse() {
|
||||
return html;
|
||||
}
|
||||
|
||||
public String parse(String... p) {
|
||||
String returnValue = this.html;
|
||||
for (int i = 0; i < p.length; i++) {
|
||||
returnValue = returnValue.replaceAll("REPLACE" + i, p[i]);
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
|
||||
package main.java.com.djrapitops.plan.ui.graphs;
|
||||
|
||||
import com.djrapitops.plan.Plan;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import org.bukkit.Location;
|
||||
import org.tc33.jheatchart.HeatChart;
|
||||
import static org.bukkit.plugin.java.JavaPlugin.getPlugin;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Rsl1122
|
||||
*/
|
||||
public class HeatMapCreator {
|
||||
|
||||
public static String createLocationHeatmap(List<Location> locations) {
|
||||
double[][] data = new double[1000][1000];
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
for (int j = 0; j < 1000; j++) {
|
||||
data[i][j] = 0;
|
||||
}
|
||||
}
|
||||
for (Location loc : locations) {
|
||||
int x = loc.getBlockX()+500;
|
||||
int z = loc.getBlockZ()+500;
|
||||
if (x < 0 || x > 1000) {
|
||||
continue;
|
||||
}
|
||||
if (z < 0 || z > 1000) {
|
||||
continue;
|
||||
}
|
||||
data[x][z] = data[x][z] + 1;
|
||||
}
|
||||
HeatChart map = new HeatChart(data);
|
||||
|
||||
map.setTitle("Location heatmap.");
|
||||
map.setXAxisLabel("X");
|
||||
map.setYAxisLabel("Z");
|
||||
try {
|
||||
String folder = getPlugin(Plan.class).getDataFolder().getAbsolutePath()+File.separator+"Heatmaps";
|
||||
map.saveToFile(new File(folder + File.separator+"java-heat-chart.png"));
|
||||
} catch (IOException ex) {
|
||||
Logger.getLogger(HeatMapCreator.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
@ -76,7 +76,6 @@ public class WebSocketServer {
|
||||
Response response = new Response(output, dataReqHandler);
|
||||
response.setRequest(request);
|
||||
response.sendStaticResource();
|
||||
socket.close();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
|
@ -16,9 +16,9 @@ import java.util.UUID;
|
||||
import main.java.com.djrapitops.plan.Settings;
|
||||
import main.java.com.djrapitops.plan.data.PlanLiteAnalyzedData;
|
||||
import main.java.com.djrapitops.plan.data.PlanLitePlayerData;
|
||||
import main.java.com.djrapitops.plan.ui.Html;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
/**
|
||||
@ -168,11 +168,10 @@ public class Analysis {
|
||||
long playTime = uData.getPlayTime();
|
||||
totalPlaytime += playTime;
|
||||
String playerName = uData.getName();
|
||||
String url = "http://" + (useAlternativeIP ? alternativeIP : plugin.getServer().getIp() + ":" + port)
|
||||
+ "/player/" + playerName;
|
||||
String html = Html.BUTTON.parse(url, playerName);
|
||||
playtimes.put(html, playTime);
|
||||
latestLogins.put(html, uData.getLastPlayed());
|
||||
String url = "<a href=\"http://" + (useAlternativeIP ? alternativeIP : plugin.getServer().getIp() + ":" + port)
|
||||
+ "/player/" + playerName+"\">"+playerName+"</a>";
|
||||
playtimes.put(url, playTime);
|
||||
latestLogins.put(url, uData.getLastPlayed());
|
||||
totalLoginTimes += uData.getLoginTimes();
|
||||
int age = uData.getDemData().getAge();
|
||||
if (age != -1) {
|
||||
@ -259,7 +258,7 @@ public class Analysis {
|
||||
data.setTop50CommandsListHtml(AnalysisUtils.createTableOutOfHashMap(sData.getCommandUsage()));
|
||||
}
|
||||
} else {
|
||||
data.setTop50CommandsListHtml(Html.ERROR_TABLE.parse());
|
||||
data.setTop50CommandsListHtml("<p>Error Calcuclating Command usages (No usage data)</p>");
|
||||
}
|
||||
|
||||
data.setRefreshDate(new Date().getTime());
|
||||
|
@ -15,7 +15,6 @@ import java.util.Scanner;
|
||||
import main.java.com.djrapitops.plan.Settings;
|
||||
import main.java.com.djrapitops.plan.data.PlanLiteAnalyzedData;
|
||||
import main.java.com.djrapitops.plan.data.PlanLitePlayerData;
|
||||
import main.java.com.djrapitops.plan.ui.Html;
|
||||
import main.java.com.djrapitops.plan.ui.graphs.ActivityPieChartCreator;
|
||||
import main.java.com.djrapitops.plan.ui.graphs.PlayerActivityGraphCreator;
|
||||
import main.java.com.djrapitops.plan.utilities.comparators.MapComparator;
|
||||
@ -37,7 +36,7 @@ public class AnalysisUtils {
|
||||
*/
|
||||
public static String createGMPieChart(HashMap<GameMode, Long> gmTimes) {
|
||||
String url = GMTimesPieChartCreator.createChart(gmTimes);
|
||||
return Html.IMG.parse(url);
|
||||
return "<img src=\"" + url + "\">";
|
||||
}
|
||||
|
||||
/**
|
||||
@ -50,7 +49,7 @@ public class AnalysisUtils {
|
||||
*/
|
||||
public static String createGMPieChart(HashMap<GameMode, Long> gmTimes, long total) {
|
||||
String url = GMTimesPieChartCreator.createChart(gmTimes, total);
|
||||
return Html.IMG.parse(url);
|
||||
return "<img src=\"" + url + "\">";
|
||||
}
|
||||
|
||||
/**
|
||||
@ -69,11 +68,10 @@ public class AnalysisUtils {
|
||||
replaceMap.put("%active%", AnalysisUtils.isActive(data.getLastPlayed(), data.getPlayTime(), data.getLoginTimes())
|
||||
? "| Player is Active" : "| Player is inactive");
|
||||
int age = data.getDemData().getAge();
|
||||
replaceMap.put("%age%", (age != -1) ? "" + age : Phrase.DEM_UNKNOWN + "");
|
||||
replaceMap.put("%age%", (age != -1) ? "" + age : Phrase.DEM_UNKNOWN+"");
|
||||
replaceMap.put("%gender%", "" + data.getDemData().getGender().name().toLowerCase());
|
||||
HashMap<GameMode, Long> gmTimes = data.getGmTimes();
|
||||
replaceMap.put("%gmpiechart%", createGMPieChart(gmTimes));
|
||||
|
||||
long gmZero = gmTimes.get(GameMode.SURVIVAL);
|
||||
long gmOne = gmTimes.get(GameMode.CREATIVE);
|
||||
long gmTwo = gmTimes.get(GameMode.ADVENTURE);
|
||||
@ -87,7 +85,6 @@ public class AnalysisUtils {
|
||||
} catch (NoSuchFieldError e) {
|
||||
gmThree = 0;
|
||||
}
|
||||
Plan plugin = getPlugin(Plan.class);
|
||||
long total = gmZero + gmOne + gmTwo + gmThree;
|
||||
replaceMap.put("%gm0%", FormatUtils.formatTimeAmount("" + gmZero));
|
||||
replaceMap.put("%gm1%", FormatUtils.formatTimeAmount("" + gmOne));
|
||||
@ -95,7 +92,7 @@ public class AnalysisUtils {
|
||||
replaceMap.put("%gm3%", FormatUtils.formatTimeAmount("" + gmThree));
|
||||
replaceMap.put("%gmtotal%", FormatUtils.formatTimeAmount("" + total));
|
||||
replaceMap.put("%ips%", data.getIps().toString());
|
||||
replaceMap.put("%nicknames%", FormatUtils.swapColorsToSpan(data.getNicknames().toString()));
|
||||
replaceMap.put("%nicknames%", data.getNicknames().toString());
|
||||
replaceMap.put("%name%", data.getName());
|
||||
replaceMap.put("%registered%", FormatUtils.formatTimeStamp("" + data.getRegistered()));
|
||||
replaceMap.put("%timeskicked%", "" + data.getTimesKicked());
|
||||
@ -103,21 +100,20 @@ public class AnalysisUtils {
|
||||
replaceMap.put("%banned%", data.isBanned() ? "Banned" : "Not Banned");
|
||||
replaceMap.put("%op%", data.isOp() ? ", Operator (Op)" : "");
|
||||
replaceMap.put("%isonline%", (data.isOnline()) ? "| Online" : "| Offline");
|
||||
replaceMap.put("%version%", plugin.getDescription().getVersion());
|
||||
PlanLiteHook hook = plugin.getPlanLiteHook();
|
||||
PlanLiteHook hook = getPlugin(Plan.class).getPlanLiteHook();
|
||||
if (hook != null) {
|
||||
replaceMap.put("%planlite%", hook.isEnabled() ? getPlanLitePlayerHtml(data.getPlanLiteData()) : "");
|
||||
} else {
|
||||
replaceMap.put("%planlite%", "");
|
||||
}
|
||||
replaceMap.put("%inaccuratedatawarning%", (new Date().getTime() - data.getRegistered() < 180000)
|
||||
? Html.WARN_INACCURATE.parse() : "");
|
||||
? "<h3>Data might be inaccurate, player has just registered.</h3>" : "");
|
||||
return replaceMap;
|
||||
}
|
||||
|
||||
static String createPlayerActivityGraph(HashMap<Long, ServerData> rawServerData, long scale) {
|
||||
String url = PlayerActivityGraphCreator.createChart(rawServerData, scale);
|
||||
return Html.IMG.parse(url);
|
||||
return "<img src=\"" + url + "\">";
|
||||
}
|
||||
|
||||
/**
|
||||
@ -143,7 +139,7 @@ public class AnalysisUtils {
|
||||
replaceMap.put("%playerchartweek%", data.getPlayersChartImgHtmlWeek());
|
||||
replaceMap.put("%playerchartday%", data.getPlayersChartImgHtmlDay());
|
||||
replaceMap.put("%top50commands%", data.getTop50CommandsListHtml());
|
||||
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("%totalplaytime%", FormatUtils.formatTimeAmount("" + data.getTotalPlayTime()));
|
||||
replaceMap.put("%ops%", "" + data.getOps());
|
||||
@ -151,9 +147,7 @@ public class AnalysisUtils {
|
||||
replaceMap.put("%totallogins%", "" + data.getTotalLoginTimes());
|
||||
replaceMap.put("%top20mostactive%", data.getTop20ActivePlayers());
|
||||
replaceMap.put("%recentlogins%", data.getRecentPlayers());
|
||||
Plan plugin = getPlugin(Plan.class);
|
||||
PlanLiteHook hook = plugin.getPlanLiteHook();
|
||||
replaceMap.put("%version%", plugin.getDescription().getVersion());
|
||||
PlanLiteHook hook = getPlugin(Plan.class).getPlanLiteHook();
|
||||
if (hook != null) {
|
||||
replaceMap.put("%planlite%", hook.isEnabled() ? getPlanLiteAnalysisHtml(data.getPlanLiteData()) : "");
|
||||
} else {
|
||||
@ -163,6 +157,7 @@ public class AnalysisUtils {
|
||||
}
|
||||
|
||||
static boolean isActive(long lastPlayed, long playTime, int loginTimes) {
|
||||
Plan plugin = getPlugin(Plan.class);
|
||||
int timeToActive = Settings.ANALYSIS_MINUTES_FOR_ACTIVE.getNumber();
|
||||
if (timeToActive < 0) {
|
||||
timeToActive = 0;
|
||||
@ -180,7 +175,7 @@ public class AnalysisUtils {
|
||||
|
||||
static String createActivityPieChart(int totalBanned, int active, int inactive, int joinleaver) {
|
||||
String url = ActivityPieChartCreator.createChart(totalBanned, active, inactive, joinleaver);
|
||||
return Html.IMG.parse(url);
|
||||
return "<img src=\"" + url + "\">";
|
||||
}
|
||||
|
||||
static String createTableOutOfHashMap(HashMap<String, Integer> commandUse) {
|
||||
@ -193,9 +188,9 @@ public class AnalysisUtils {
|
||||
|
||||
static String createTableOutOfHashMap(HashMap<String, Integer> map, int limit) {
|
||||
List<String[]> sorted = MapComparator.sortByValue(map);
|
||||
String html = Html.TABLE_START.parse();
|
||||
String html = "<table style=\"border-collapse: collapse;table-layout: fixed; border-style: solid; border-width: 1px; width: 100%;\">";
|
||||
if (sorted.isEmpty()) {
|
||||
html = Html.ERROR_TABLE.parse();
|
||||
html = "<p>Error Calcuclating Table usages (sorted data was empty)</p>";
|
||||
return html;
|
||||
}
|
||||
Collections.reverse(sorted);
|
||||
@ -204,18 +199,18 @@ public class AnalysisUtils {
|
||||
if (i >= limit) {
|
||||
break;
|
||||
}
|
||||
html += Html.TABLELINE.parse(values[1], values[0]);
|
||||
html += "<tr style=\"text-align: center;border-style: solid; border-width: 1px;height: 28px;\"><td><b>" + values[1] + "</b></td>\r\n<td>" + values[0] + "</td></tr>";
|
||||
i++;
|
||||
}
|
||||
html += Html.TABLE_END.parse();
|
||||
html += "</table>";
|
||||
return html;
|
||||
}
|
||||
|
||||
static String createActivePlayersTable(HashMap<String, Long> map, int limit) {
|
||||
List<String[]> sorted = MapComparator.sortByValueLong(map);
|
||||
String html = Html.TABLE_START.parse();
|
||||
String html = "<table style=\"border-collapse: collapse;table-layout: fixed; border-style: solid; border-width: 1px; width: 100%;\">";
|
||||
if (sorted.isEmpty()) {
|
||||
html = Html.ERROR_TABLE.parse()+Html.TABLE_END.parse();
|
||||
html = "<p>Error Calculating Active players (sorted list was empty)</p>";
|
||||
return html;
|
||||
}
|
||||
Collections.reverse(sorted);
|
||||
@ -224,13 +219,13 @@ public class AnalysisUtils {
|
||||
if (i >= limit) {
|
||||
break;
|
||||
}
|
||||
html += Html.TABLELINE.parse(values[1].replaceAll(Html.BUTTON_CLASS.parse(), Html.LINK_CLASS.parse()),FormatUtils.formatTimeAmount(values[0]));
|
||||
html += "<tr style=\"text-align: center;border-style: solid; border-width: 1px;height: 28px;\"><td><b>" + values[1] + "</b></td>\r\n<td>" + FormatUtils.formatTimeAmount(values[0]) + "</td></tr>";
|
||||
i++;
|
||||
}
|
||||
html += Html.TABLE_END.parse();
|
||||
html += "</table>";
|
||||
return html;
|
||||
}
|
||||
|
||||
|
||||
static String createListStringOutOfHashMapLong(HashMap<String, Long> map, int limit) {
|
||||
List<String[]> sorted = MapComparator.sortByValueLong(map);
|
||||
String html = "<p>";
|
||||
@ -244,7 +239,7 @@ public class AnalysisUtils {
|
||||
if (i >= limit) {
|
||||
break;
|
||||
}
|
||||
html += values[1] + " ";
|
||||
html += values[1]+" ";
|
||||
i++;
|
||||
}
|
||||
html += "</p>";
|
||||
@ -269,12 +264,12 @@ public class AnalysisUtils {
|
||||
private static HashMap<String, String> getPlanLiteAnalysisReplaceRules(PlanLiteAnalyzedData planLiteData) {
|
||||
HashMap<String, String> replaceMap = new HashMap<>();
|
||||
PlanLiteHook hook = getPlugin(Plan.class).getPlanLiteHook();
|
||||
replaceMap.put("%townyheader%", hook.hasTowny() ? Html.TOP_TOWNS.parse() : "");
|
||||
replaceMap.put("%townyheader%", hook.hasTowny() ? "<p>Top 20 Towns</p>" : "");
|
||||
replaceMap.put("%townylist%", hook.hasTowny() ? createTableOutOfHashMap(planLiteData.getTownMap(), 20) : "");
|
||||
replaceMap.put("%factionheader%", hook.hasFactions() ? Html.TOP_FACTIONS.parse() : "");
|
||||
replaceMap.put("%factionheader%", hook.hasFactions() ? "<p>Top 20 Factions</p>" : "");
|
||||
replaceMap.put("%factionlist%", hook.hasFactions() ? createTableOutOfHashMap(planLiteData.getFactionMap(), 20) : "");
|
||||
replaceMap.put("%totalmoneyline%", hook.hasVault() ? Html.TOTAL_BALANCE.parse(planLiteData.getTotalMoney()+"") : "");
|
||||
replaceMap.put("%totalvotesline%", hook.hasSuperbVote() ? Html.TOTAL_VOTES.parse(planLiteData.getTotalVotes()+"") : "");
|
||||
replaceMap.put("%totalmoneyline%", hook.hasVault() ? "<p>Server Total Balance: " + planLiteData.getTotalMoney() + "</p>" : "");
|
||||
replaceMap.put("%totalvotesline%", hook.hasSuperbVote() ? "<p>Players have voted total of " + planLiteData.getTotalVotes() + " times.</p>" : "");
|
||||
return replaceMap;
|
||||
}
|
||||
|
||||
@ -296,13 +291,13 @@ public class AnalysisUtils {
|
||||
private static HashMap<String, String> getPlanLitePlayerReplaceRules(PlanLitePlayerData planLiteData) {
|
||||
HashMap<String, String> replaceMap = new HashMap<>();
|
||||
PlanLiteHook hook = getPlugin(Plan.class).getPlanLiteHook();
|
||||
replaceMap.put("%townylinetown%", hook.hasTowny() ? Html.TOWN.parse(planLiteData.getTown()) : "");
|
||||
replaceMap.put("%townylinetown%", hook.hasTowny() ? "<p>Town: " + planLiteData.getTown() + "</p>" : "");
|
||||
replaceMap.put("%townylineplotperms%", "");
|
||||
replaceMap.put("%townylineplotoptions%", hook.hasTowny() ? Html.PLOT_OPTIONS.parse(planLiteData.getPlotOptions()) : "");
|
||||
replaceMap.put("%townylinefriends%", hook.hasTowny() ? Html.FRIENDS.parse(planLiteData.getFriends()) : "");
|
||||
replaceMap.put("%factionsline%", hook.hasFactions() ? Html.FACTION.parse(planLiteData.getFaction()) : "");
|
||||
replaceMap.put("%totalmoneyline%", hook.hasVault() ? Html.BALANCE.parse(planLiteData.getMoney()+"") : "");
|
||||
replaceMap.put("%totalvotesline%", hook.hasSuperbVote() ? Html.VOTES.parse(planLiteData.getVotes()+"") : "");
|
||||
replaceMap.put("%townylineplotoptions%", hook.hasTowny() ? "<p>Plot options: " + planLiteData.getPlotOptions() + "</p>" : "");
|
||||
replaceMap.put("%townylinefriends%", hook.hasTowny() ? "<p>Friends with " + planLiteData.getFriends() + "</p>" : "");
|
||||
replaceMap.put("%factionsline%", hook.hasFactions() ? "<p>Faction: " + planLiteData.getFaction() + "</p>" : "");
|
||||
replaceMap.put("%totalmoneyline%", hook.hasVault() ? "<p>Balance: " + planLiteData.getMoney() + "</p>" : "");
|
||||
replaceMap.put("%totalvotesline%", hook.hasSuperbVote() ? "<p>Player has voted " + planLiteData.getVotes() + " times.</p>" : "");
|
||||
return replaceMap;
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,6 @@
|
||||
package com.djrapitops.plan.utilities;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import main.java.com.djrapitops.plan.ui.Html;
|
||||
import org.bukkit.Location;
|
||||
|
||||
/**
|
||||
@ -152,20 +150,4 @@ public class FormatUtils {
|
||||
return "x " + loc.getBlockX() + " z " + loc.getBlockZ() + " in " + loc.getWorld();
|
||||
}
|
||||
|
||||
static String swapColorsToSpan(String string) {
|
||||
Html[] replacer = new Html[]{Html.COLOR_0, Html.COLOR_1, Html.COLOR_2, Html.COLOR_3,
|
||||
Html.COLOR_4, Html.COLOR_5, Html.COLOR_6, Html.COLOR_7, Html.COLOR_8, Html.COLOR_9,
|
||||
Html.COLOR_a, Html.COLOR_b, Html.COLOR_c, Html.COLOR_d, Html.COLOR_e, Html.COLOR_f};
|
||||
|
||||
|
||||
for (Html html : replacer) {
|
||||
string = string.replaceAll("§"+html.name().charAt(6), html.parse());
|
||||
}
|
||||
int spans = string.split("<span").length-1;
|
||||
for (int i = 0; i < spans; i++) {
|
||||
string = Html.SPAN.parse(string);
|
||||
}
|
||||
return string.replaceAll("§r", "");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,132 +1,57 @@
|
||||
<!DOCTYPE html>
|
||||
<!doctype html>
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<title>Plan | Server Analysis</title>
|
||||
<meta name="description" content="Player Analysis window">
|
||||
<meta name="description" content="Server Analysis Window">
|
||||
<meta name="author" content="Rsl1122">
|
||||
<link rel="icon" href="https://puu.sh/tK0KL/6aa2ba141b.ico" type="image/x-icon" />
|
||||
<style>
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
img {
|
||||
width: auto;
|
||||
}
|
||||
body {
|
||||
line-height: 140%;
|
||||
font-family: Verdana, Geneva, sans-serif;
|
||||
font-style: normal;
|
||||
}
|
||||
header, footer {
|
||||
line-height: 40%;
|
||||
background-color: #267F00;
|
||||
color: white;
|
||||
padding: 10px 15px 5px 15px;
|
||||
font-family: futura-pt, Futura, Futura-Medium, Verdana, Geneva, sans-serif;
|
||||
font-style: normal;
|
||||
}
|
||||
.column {
|
||||
float: left;
|
||||
padding: 15px;
|
||||
}
|
||||
.warn {
|
||||
padding: 8px;
|
||||
background-color: #ffcc00;
|
||||
color: black;
|
||||
margin: 0;
|
||||
}
|
||||
.clearfix::after {
|
||||
content: "";
|
||||
clear: both;
|
||||
display: table;
|
||||
}
|
||||
.info {
|
||||
width: 40%;
|
||||
}
|
||||
.graphs {
|
||||
width: 60%
|
||||
}
|
||||
.button {
|
||||
padding: 8px 14px;
|
||||
background-color: green;
|
||||
border: none;
|
||||
color: white;
|
||||
outline: 0;
|
||||
text-decoration:none!important;
|
||||
}
|
||||
.button:hover {
|
||||
background-color: darkgreen;
|
||||
}
|
||||
.table {
|
||||
border-collapse: collapse;
|
||||
table-layout: fixed;
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
padding: 8px 14px;
|
||||
width: 70%;
|
||||
}
|
||||
.tableline {
|
||||
text-align: left;
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
}
|
||||
.buttons {
|
||||
line-height: 270%;
|
||||
}
|
||||
.link {
|
||||
color: green;
|
||||
text-decoration:none!important;
|
||||
}
|
||||
.link:hover {
|
||||
color: darkgreen;
|
||||
}
|
||||
|
||||
</style>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.js"></script>
|
||||
<![endif]-->
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<header>
|
||||
<img style="float: right; padding: 5px" src="http://puu.sh/tJZUb/c2e0ab220f.png" alt="Player Analytics | Analysis">
|
||||
<p style="float: right; text-align: right;">Player Analytics v.%version%</p>
|
||||
<h1>Plan | Server Analysis</h1>
|
||||
<div style="line-height: 55%; font-family: Verdana, Geneva, sans-serif;padding: 2px 4px 2px 3px;">
|
||||
<h1 style="text-decoration: underline;">Plan | Server Analysis</h1>
|
||||
<h4>Analysis refreshed %refresh% ago</h4>
|
||||
</header>
|
||||
<div class="clearfix">
|
||||
<div class="column graphs">
|
||||
|
||||
<h4>Player Activity - Last 24h</h4>
|
||||
%playerchartday%
|
||||
<h4>Player Activity - Last 7 days</h4>
|
||||
%playerchartweek%
|
||||
<h4>Player Activity - Last 30 days</h4>
|
||||
%playerchartmonth%
|
||||
<div class="buttons">
|
||||
<p><b>Most recent logins</b>: %recentlogins%</p>
|
||||
</div>
|
||||
<h4>Top 20 Most Active</h4>
|
||||
%top20mostactive%
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td style="margin-left: 3px; margin-right: auto;
|
||||
border-style: groove; border-width: 3px; border-radius: 12px; padding: 2px 4px 2px 3px;
|
||||
box-shadow: 5px 5px 4px 0px #888888;">
|
||||
<h4>Player Activity - Last 24h</h4>
|
||||
%playerchartday%
|
||||
<h4>Player Activity - Last 7 days</h4>
|
||||
%playerchartweek%
|
||||
<h4>Player Activity - Last 30 days</h4>
|
||||
%playerchartmonth%
|
||||
<p><b>Most recent logins</b>: %recentlogins%</p>
|
||||
<h4>Top 20 Most Active</h4>
|
||||
%top20mostactive%
|
||||
</td>
|
||||
<td style="margin-left: 3px; margin-right: auto;
|
||||
border-style: groove; border-width: 3px; border-radius: 12px; padding: 2px 4px 2px 3px;
|
||||
box-shadow: 5px 5px 4px 0px #888888;text-align: left;vertical-align: top;">
|
||||
<h4>Information</h4>
|
||||
<p>%activitytotal% players have played on this server.</p>
|
||||
<p>A Total of %totalplaytime% has been played with the average of %avgplaytime%</p>
|
||||
<p>Players have joined %totallogins% times.</p>
|
||||
<p>The average of known player ages is %avgage%.</p>
|
||||
<br/><h4>Playerbase composition</h4>
|
||||
%activitypiechart%
|
||||
<p>Active %active% | Inactive %inactive% | Banned %banned% | Joined once %joinleaver% | Total: %activitytotal%</p>
|
||||
<br/><h4>Gamemode Usage</h4>
|
||||
%gmpiechart%
|
||||
<p>Survival: %gm0% | Creative: %gm1% | Adventure: %gm2% | Spectator: %gm3%</p>
|
||||
<br/><h4>Top 50 Most used commands</h4>
|
||||
%top50commands%
|
||||
</td>
|
||||
</tr>
|
||||
%planlite%
|
||||
</div>
|
||||
|
||||
<div class="column info">
|
||||
<h4>Information</h4>
|
||||
<p>%activitytotal% players have played on this server.<br/>
|
||||
A Total of %totalplaytime% has been played with the average of %avgplaytime%<br/>
|
||||
Players have joined %totallogins% times.<br/>
|
||||
The average of known player ages is %avgage%.</p>
|
||||
<h4>Playerbase composition</h4>
|
||||
%activitypiechart%
|
||||
<p>Active %active% | Inactive %inactive% | Banned %banned% | Joined once %joinleaver% <br/>
|
||||
Total: %activitytotal%</p>
|
||||
<br/><h4>Gamemode Usage</h4>
|
||||
%gmpiechart%
|
||||
<p>Survival: %gm0% | Creative: %gm1% | Adventure: %gm2% | Spectator: %gm3%</p>
|
||||
<h4>Top 50 Most used commands</h4>
|
||||
%top50commands%
|
||||
</div>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -1,130 +1,47 @@
|
||||
<!DOCTYPE html>
|
||||
<!doctype html>
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<title>Plan | Inspect %name%</title>
|
||||
<meta name="description" content="Player inspect window">
|
||||
<meta name="author" content="Rsl1122">
|
||||
<link rel="icon" href="https://puu.sh/tK0KL/6aa2ba141b.ico" type="image/x-icon" />
|
||||
<style>
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
img {
|
||||
width: auto;
|
||||
}
|
||||
body {
|
||||
line-height: 140%;
|
||||
font-family: Verdana, Geneva, sans-serif;
|
||||
font-style: normal;
|
||||
}
|
||||
header, footer {
|
||||
line-height: 40%;
|
||||
background-color: #267F00;
|
||||
color: white;
|
||||
padding: 10px 15px 5px 15px;
|
||||
font-family: futura-pt, Futura, Futura-Medium, Verdana, Geneva, sans-serif;
|
||||
font-style: normal;
|
||||
}
|
||||
.column {
|
||||
float: left;
|
||||
padding: 15px;
|
||||
}
|
||||
.warn {
|
||||
padding: 8px;
|
||||
background-color: #ffcc00;
|
||||
color: black;
|
||||
margin: 0;
|
||||
}
|
||||
.clearfix::after {
|
||||
content: "";
|
||||
clear: both;
|
||||
display: table;
|
||||
}
|
||||
.info {
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.black {
|
||||
color: #000000;
|
||||
}
|
||||
.darkblue {
|
||||
color: #0000AA;
|
||||
}
|
||||
.darkgreen {
|
||||
color: #00AA00;
|
||||
}
|
||||
.darkaqua {
|
||||
color: #00AAAA;
|
||||
}
|
||||
.darkred {
|
||||
color: #AA0000;
|
||||
}
|
||||
.darkpurple {
|
||||
color: #AA00AA;
|
||||
}
|
||||
.gold {
|
||||
color: #FFAA00;
|
||||
}
|
||||
.gray {
|
||||
color: #AAAAAA;
|
||||
}
|
||||
.darkgray {
|
||||
color: #555555;
|
||||
}
|
||||
.blue {
|
||||
color: #5555FF;
|
||||
}
|
||||
.green {
|
||||
color: #55FF55;
|
||||
}
|
||||
.aqua {
|
||||
color: #55FFFF;
|
||||
}
|
||||
.red {
|
||||
color: #FF5555;
|
||||
}
|
||||
.pink {
|
||||
color: #FF55FF;
|
||||
}
|
||||
.yellow {
|
||||
color: #FFFF55;
|
||||
}
|
||||
.white {
|
||||
color: #FFFFFF;
|
||||
}
|
||||
</style>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.js"></script>
|
||||
<![endif]-->
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<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>
|
||||
<div style="line-height: 55%; font-family: Verdana, Geneva, sans-serif;padding: 2px 4px 2px 3px;">
|
||||
<h1 style="text-decoration: underline;">Plan | Inspect Player %name%</h1>
|
||||
<h4>UUID: %uuid%</h4>
|
||||
<h4>Registered: %registered% %banned%%op%</h4>
|
||||
</header>
|
||||
<div class="clearfix">
|
||||
%inaccuratedatawarning%
|
||||
<div class="column info">
|
||||
|
||||
<h4>Information</h4>
|
||||
<p>Last seen: %lastseen% %active% %isonline%<br/>
|
||||
Nicknames: %nicknames% | Has connected from ips: %ips%<br/>
|
||||
Geolocation: %geoloc%<br/>
|
||||
Playtime: %playtime%<br/>
|
||||
Has logged in %logintimes% times. | Has been kicked %timeskicked% times.<br/>
|
||||
Age: %age% | Gender: %gender%<br/>
|
||||
UUID: %uuid%</p>
|
||||
<table>
|
||||
<tr>
|
||||
<td style="margin-left: 3px; margin-right: auto;
|
||||
border-style: groove; border-width: 3px; border-radius: 12px; padding: 2px 4px 2px 3px;
|
||||
box-shadow: 5px 5px 4px 0px #888888;">
|
||||
<h4>Information</h4>
|
||||
<p>Last seen: %lastseen% %active% %isonline%</p>
|
||||
<p>Nicknames: %nicknames% | Has connected from ips: %ips%</p>
|
||||
<p>Geolocation: %geoloc%</p>
|
||||
<p>Playtime: %playtime%</p>
|
||||
<p>Has logged in %logintimes% times. | Has been kicked %timeskicked% times.</p>
|
||||
<p>Age: %age% | Gender: %gender%</p>
|
||||
</td>
|
||||
<td style="margin-left: 3px; margin-right: auto;
|
||||
border-style: groove; border-width: 3px; border-radius: 12px; padding: 2px 4px 2px 3px;
|
||||
box-shadow: 5px 5px 4px 0px #888888;">
|
||||
<h4>Gamemode Usage</h4>
|
||||
%gmpiechart%
|
||||
<p>Survival: %gm0% | Creative: %gm1% | Adventure: %gm2% | Spectator: %gm3% | Total: %gmtotal%</p>
|
||||
</td>
|
||||
</tr>
|
||||
%planlite%
|
||||
</div>
|
||||
|
||||
<div class="column info">
|
||||
<h4>Gamemode Usage</h4>
|
||||
%gmpiechart%
|
||||
<p>Survival: %gm0% | Creative: %gm1% | Adventure: %gm2% | Spectator: %gm3% <br/>Total: %gmtotal%</p>
|
||||
</div>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -1,7 +1,7 @@
|
||||
name: Plan
|
||||
author: Rsl1122
|
||||
main: com.djrapitops.plan.Plan
|
||||
version: 2.4.0
|
||||
version: 2.3.1
|
||||
|
||||
commands:
|
||||
plan:
|
||||
|
Loading…
Reference in New Issue
Block a user