diff --git a/Plan/pom.xml b/Plan/pom.xml index fcf86109f..6bfcce4b4 100644 --- a/Plan/pom.xml +++ b/Plan/pom.xml @@ -30,6 +30,12 @@ 1.3 compile + + com.javaheatmap + jheatchart + 0.6 + compile + clean package install diff --git a/Plan/src/main/java/com/djrapitops/plan/Phrase.java b/Plan/src/main/java/com/djrapitops/plan/Phrase.java index 8a4c0314d..36c6a88cb 100644 --- a/Plan/src/main/java/com/djrapitops/plan/Phrase.java +++ b/Plan/src/main/java/com/djrapitops/plan/Phrase.java @@ -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); } /** diff --git a/Plan/src/main/java/com/djrapitops/plan/Plan.java b/Plan/src/main/java/com/djrapitops/plan/Plan.java index f716cd4d8..3d477cc81 100644 --- a/Plan/src/main/java/com/djrapitops/plan/Plan.java +++ b/Plan/src/main/java/com/djrapitops/plan/Plan.java @@ -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); diff --git a/Plan/src/main/java/com/djrapitops/plan/Settings.java b/Plan/src/main/java/com/djrapitops/plan/Settings.java index 57adf1ae3..574139715 100644 --- a/Plan/src/main/java/com/djrapitops/plan/Settings.java +++ b/Plan/src/main/java/com/djrapitops/plan/Settings.java @@ -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; diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/ReloadCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/ReloadCommand.java index 467dd261e..1e9ce4503 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/ReloadCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/ReloadCommand.java @@ -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."); diff --git a/Plan/src/main/java/com/djrapitops/plan/ui/Html.java b/Plan/src/main/java/com/djrapitops/plan/ui/Html.java deleted file mode 100644 index 8bef1e7af..000000000 --- a/Plan/src/main/java/com/djrapitops/plan/ui/Html.java +++ /dev/null @@ -1,67 +0,0 @@ -package main.java.com.djrapitops.plan.ui; - -/** - * - * @author Rsl1122 - */ -public enum Html { - - REPLACE0("REPLACE0"), - REPLACE1("REPLACE1"), - WARN_INACCURATE("
Data might be inaccurate, player has just registered.
"), - COLOR_0(""), - COLOR_1(""), - COLOR_2(""), - COLOR_3(""), - COLOR_4(""), - COLOR_5(""), - COLOR_6(""), - COLOR_7(""), - COLOR_8(""), - COLOR_9(""), - COLOR_a(""), - COLOR_b(""), - COLOR_c(""), - COLOR_d(""), - COLOR_e(""), - COLOR_f(""), - SPAN(""+REPLACE0+""), - BUTTON(""+REPLACE1+""), - BUTTON_CLASS("class=\"button\""), - LINK_CLASS("class=\"link\""), - TABLE_START(""), - TABLE_END("
"), - TABLELINE(""+REPLACE0+"\r\n"+REPLACE1+""), - ERROR_TABLE("

Error Calcuclating Table (No data)

"), - IMG(""), - TOP_TOWNS("

Top 20 Towns

"), - TOP_FACTIONS("

Top 20 Factions

"), - TOTAL_BALANCE("

Server Total Balance: "+REPLACE0+"

"), - TOTAL_VOTES("

Players have voted total of "+REPLACE0+" times.

"), - TOWN("

Town: "+REPLACE0+"

"), - PLOT_OPTIONS("

Plot options: "+REPLACE0+"

"), - FRIENDS("

Friends with "+REPLACE0+"

"), - FACTION("

Faction: " + REPLACE0 + "

"), - BALANCE("

Balance: " + REPLACE0 + "

"), - VOTES("

Player has voted " + REPLACE0 + " times.

") - ; - - 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; - } - -} diff --git a/Plan/src/main/java/com/djrapitops/plan/ui/graphs/HeatMapCreator.java b/Plan/src/main/java/com/djrapitops/plan/ui/graphs/HeatMapCreator.java new file mode 100644 index 000000000..97a54e0bd --- /dev/null +++ b/Plan/src/main/java/com/djrapitops/plan/ui/graphs/HeatMapCreator.java @@ -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 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 ""; + } + +} diff --git a/Plan/src/main/java/com/djrapitops/plan/ui/webserver/WebSocketServer.java b/Plan/src/main/java/com/djrapitops/plan/ui/webserver/WebSocketServer.java index e440e0091..3cdcbe5a3 100644 --- a/Plan/src/main/java/com/djrapitops/plan/ui/webserver/WebSocketServer.java +++ b/Plan/src/main/java/com/djrapitops/plan/ui/webserver/WebSocketServer.java @@ -76,7 +76,6 @@ public class WebSocketServer { Response response = new Response(output, dataReqHandler); response.setRequest(request); response.sendStaticResource(); - socket.close(); } catch (IOException e) { } } diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/Analysis.java b/Plan/src/main/java/com/djrapitops/plan/utilities/Analysis.java index 46278ff28..0daa7f03e 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/Analysis.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/Analysis.java @@ -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 = ""+playerName+""; + 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("

Error Calcuclating Command usages (No usage data)

"); } data.setRefreshDate(new Date().getTime()); diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/AnalysisUtils.java b/Plan/src/main/java/com/djrapitops/plan/utilities/AnalysisUtils.java index 8c98e5f77..209ac35cc 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/AnalysisUtils.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/AnalysisUtils.java @@ -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 gmTimes) { String url = GMTimesPieChartCreator.createChart(gmTimes); - return Html.IMG.parse(url); + return ""; } /** @@ -50,7 +49,7 @@ public class AnalysisUtils { */ public static String createGMPieChart(HashMap gmTimes, long total) { String url = GMTimesPieChartCreator.createChart(gmTimes, total); - return Html.IMG.parse(url); + return ""; } /** @@ -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 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() : ""); + ? "

Data might be inaccurate, player has just registered.

" : ""); return replaceMap; } static String createPlayerActivityGraph(HashMap rawServerData, long scale) { String url = PlayerActivityGraphCreator.createChart(rawServerData, scale); - return Html.IMG.parse(url); + return ""; } /** @@ -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 ""; } static String createTableOutOfHashMap(HashMap commandUse) { @@ -193,9 +188,9 @@ public class AnalysisUtils { static String createTableOutOfHashMap(HashMap map, int limit) { List sorted = MapComparator.sortByValue(map); - String html = Html.TABLE_START.parse(); + String html = ""; if (sorted.isEmpty()) { - html = Html.ERROR_TABLE.parse(); + html = "

Error Calcuclating Table usages (sorted data was empty)

"; 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 += "\r\n"; i++; } - html += Html.TABLE_END.parse(); + html += "
" + values[1] + "" + values[0] + "
"; return html; } static String createActivePlayersTable(HashMap map, int limit) { List sorted = MapComparator.sortByValueLong(map); - String html = Html.TABLE_START.parse(); + String html = ""; if (sorted.isEmpty()) { - html = Html.ERROR_TABLE.parse()+Html.TABLE_END.parse(); + html = "

Error Calculating Active players (sorted list was empty)

"; 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 += "\r\n"; i++; } - html += Html.TABLE_END.parse(); + html += "
" + values[1] + "" + FormatUtils.formatTimeAmount(values[0]) + "
"; return html; } - + static String createListStringOutOfHashMapLong(HashMap map, int limit) { List sorted = MapComparator.sortByValueLong(map); String html = "

"; @@ -244,7 +239,7 @@ public class AnalysisUtils { if (i >= limit) { break; } - html += values[1] + " "; + html += values[1]+" "; i++; } html += "

"; @@ -269,12 +264,12 @@ public class AnalysisUtils { private static HashMap getPlanLiteAnalysisReplaceRules(PlanLiteAnalyzedData planLiteData) { HashMap replaceMap = new HashMap<>(); PlanLiteHook hook = getPlugin(Plan.class).getPlanLiteHook(); - replaceMap.put("%townyheader%", hook.hasTowny() ? Html.TOP_TOWNS.parse() : ""); + replaceMap.put("%townyheader%", hook.hasTowny() ? "

Top 20 Towns

" : ""); replaceMap.put("%townylist%", hook.hasTowny() ? createTableOutOfHashMap(planLiteData.getTownMap(), 20) : ""); - replaceMap.put("%factionheader%", hook.hasFactions() ? Html.TOP_FACTIONS.parse() : ""); + replaceMap.put("%factionheader%", hook.hasFactions() ? "

Top 20 Factions

" : ""); 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() ? "

Server Total Balance: " + planLiteData.getTotalMoney() + "

" : ""); + replaceMap.put("%totalvotesline%", hook.hasSuperbVote() ? "

Players have voted total of " + planLiteData.getTotalVotes() + " times.

" : ""); return replaceMap; } @@ -296,13 +291,13 @@ public class AnalysisUtils { private static HashMap getPlanLitePlayerReplaceRules(PlanLitePlayerData planLiteData) { HashMap replaceMap = new HashMap<>(); PlanLiteHook hook = getPlugin(Plan.class).getPlanLiteHook(); - replaceMap.put("%townylinetown%", hook.hasTowny() ? Html.TOWN.parse(planLiteData.getTown()) : ""); + replaceMap.put("%townylinetown%", hook.hasTowny() ? "

Town: " + planLiteData.getTown() + "

" : ""); 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() ? "

Plot options: " + planLiteData.getPlotOptions() + "

" : ""); + replaceMap.put("%townylinefriends%", hook.hasTowny() ? "

Friends with " + planLiteData.getFriends() + "

" : ""); + replaceMap.put("%factionsline%", hook.hasFactions() ? "

Faction: " + planLiteData.getFaction() + "

" : ""); + replaceMap.put("%totalmoneyline%", hook.hasVault() ? "

Balance: " + planLiteData.getMoney() + "

" : ""); + replaceMap.put("%totalvotesline%", hook.hasSuperbVote() ? "

Player has voted " + planLiteData.getVotes() + " times.

" : ""); return replaceMap; } } diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/FormatUtils.java b/Plan/src/main/java/com/djrapitops/plan/utilities/FormatUtils.java index 7e983fdb9..0372bdaac 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/FormatUtils.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/FormatUtils.java @@ -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(" + + + Plan | Server Analysis - + - - + + - -
- Player Analytics | Analysis -

Player Analytics v.%version%

-

Plan | Server Analysis

+
+

Plan | Server Analysis

Analysis refreshed %refresh% ago

-
-
-
- -

Player Activity - Last 24h

- %playerchartday% -

Player Activity - Last 7 days

- %playerchartweek% -

Player Activity - Last 30 days

- %playerchartmonth% -
-

Most recent logins: %recentlogins%

-
-

Top 20 Most Active

- %top20mostactive% - + + + + + %planlite% - - -
-

Information

-

%activitytotal% players have played on this server.
- A Total of %totalplaytime% has been played with the average of %avgplaytime%
- Players have joined %totallogins% times.
- The average of known player ages is %avgage%.

-

Playerbase composition

- %activitypiechart% -

Active %active% | Inactive %inactive% | Banned %banned% | Joined once %joinleaver%
- Total: %activitytotal%

-

Gamemode Usage

- %gmpiechart% -

Survival: %gm0% | Creative: %gm1% | Adventure: %gm2% | Spectator: %gm3%

-

Top 50 Most used commands

- %top50commands% -
- +
+

Player Activity - Last 24h

+ %playerchartday% +

Player Activity - Last 7 days

+ %playerchartweek% +

Player Activity - Last 30 days

+ %playerchartmonth% +

Most recent logins: %recentlogins%

+

Top 20 Most Active

+ %top20mostactive% +
+

Information

+

%activitytotal% players have played on this server.

+

A Total of %totalplaytime% has been played with the average of %avgplaytime%

+

Players have joined %totallogins% times.

+

The average of known player ages is %avgage%.

+

Playerbase composition

+ %activitypiechart% +

Active %active% | Inactive %inactive% | Banned %banned% | Joined once %joinleaver% | Total: %activitytotal%

+

Gamemode Usage

+ %gmpiechart% +

Survival: %gm0% | Creative: %gm1% | Adventure: %gm2% | Spectator: %gm3%

+

Top 50 Most used commands

+ %top50commands% +
\ No newline at end of file diff --git a/Plan/src/main/resources/player.html b/Plan/src/main/resources/player.html index c88fc2e4d..c25b9ca8b 100644 --- a/Plan/src/main/resources/player.html +++ b/Plan/src/main/resources/player.html @@ -1,130 +1,47 @@ - + + + Plan | Inspect %name% - - + + - -
- Player Analytics | Inspect %name% -

Player Analytics v.%version%

-

Plan | Inspect Player %name%

+
+

Plan | Inspect Player %name%

+

UUID: %uuid%

Registered: %registered% %banned%%op%

-
-
%inaccuratedatawarning% -
- -

Information

-

Last seen: %lastseen% %active% %isonline%
- Nicknames: %nicknames% | Has connected from ips: %ips%
- Geolocation: %geoloc%
- Playtime: %playtime%
- Has logged in %logintimes% times. | Has been kicked %timeskicked% times.
- Age: %age% | Gender: %gender%
- UUID: %uuid%

+ + + + + %planlite% - - -
-

Gamemode Usage

- %gmpiechart% -

Survival: %gm0% | Creative: %gm1% | Adventure: %gm2% | Spectator: %gm3%
Total: %gmtotal%

-
- +
+

Information

+

Last seen: %lastseen% %active% %isonline%

+

Nicknames: %nicknames% | Has connected from ips: %ips%

+

Geolocation: %geoloc%

+

Playtime: %playtime%

+

Has logged in %logintimes% times. | Has been kicked %timeskicked% times.

+

Age: %age% | Gender: %gender%

+
+

Gamemode Usage

+ %gmpiechart% +

Survival: %gm0% | Creative: %gm1% | Adventure: %gm2% | Spectator: %gm3% | Total: %gmtotal%

+
- \ No newline at end of file diff --git a/Plan/src/main/resources/plugin.yml b/Plan/src/main/resources/plugin.yml index 144ec33ed..92c04afa7 100644 --- a/Plan/src/main/resources/plugin.yml +++ b/Plan/src/main/resources/plugin.yml @@ -1,7 +1,7 @@ name: Plan author: Rsl1122 main: com.djrapitops.plan.Plan -version: 2.4.0 +version: 2.3.1 commands: plan: