")
- ;
-
- 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 += "
" + values[1] + "
\r\n
" + values[0] + "
";
i++;
}
- html += Html.TABLE_END.parse();
+ html += "
";
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 += "
" + values[1] + "
\r\n
" + FormatUtils.formatTimeAmount(values[0]) + "
";
i++;
}
- html += Html.TABLE_END.parse();
+ html += "
";
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 += "
%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%