From 9da01941d7296e07b8bad33646ea08486fb32e21 Mon Sep 17 00:00:00 2001 From: Fuzzlemann Date: Fri, 11 Aug 2017 17:15:46 +0200 Subject: [PATCH 01/12] Add null check add DumpLog.addLine(CharSequence) Cancels the DumpLog task (Forgot it) --- .../plan/command/commands/manage/ManageDumpCommand.java | 8 ++++++-- .../com/djrapitops/plan/utilities/file/dump/DumpLog.java | 5 +++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageDumpCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageDumpCommand.java index 9d8ca7382..a51d4e801 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageDumpCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageDumpCommand.java @@ -50,8 +50,12 @@ public class ManageDumpCommand extends SubCommand { plugin.getRunnableFactory().createNew(new AbsRunnable("DumpTask") { @Override public void run() { - sender.sendLink("Link to the Dump", DumpUtils.dump(plugin)); - sender.sendLink("Report Issues here", "https://github.com/Rsl1122/Plan-PlayerAnalytics/issues/new"); + try { + sender.sendLink("Link to the Dump", DumpUtils.dump(plugin)); + sender.sendLink("Report Issues here", "https://github.com/Rsl1122/Plan-PlayerAnalytics/issues/new"); + } finally { + this.cancel(); + } } }).runTaskAsynchronously(); } diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/file/dump/DumpLog.java b/Plan/src/main/java/com/djrapitops/plan/utilities/file/dump/DumpLog.java index ec12ed12f..a996f1027 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/file/dump/DumpLog.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/file/dump/DumpLog.java @@ -88,6 +88,11 @@ public class DumpLog { * @param line The content of the line */ private void addLine(CharSequence line) { + if (line == null) { + lines.add("\n"); + return; + } + lines.add(line.toString()); } From bb573d0b2bcce995c4950ffff5462b25bbafe48b Mon Sep 17 00:00:00 2001 From: Fuzzlemann Date: Fri, 11 Aug 2017 17:54:43 +0200 Subject: [PATCH 02/12] Adds splitting of the dump log because of the Hastebin max character length --- .../plan/utilities/file/dump/DumpLog.java | 44 ++++++++++++++++--- .../plan/utilities/file/dump/DumpUtils.java | 2 +- 2 files changed, 40 insertions(+), 6 deletions(-) diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/file/dump/DumpLog.java b/Plan/src/main/java/com/djrapitops/plan/utilities/file/dump/DumpLog.java index a996f1027..a89efa022 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/file/dump/DumpLog.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/file/dump/DumpLog.java @@ -1,6 +1,9 @@ package main.java.com.djrapitops.plan.utilities.file.dump; +import com.google.common.base.Splitter; +import com.google.common.collect.ImmutableList; import main.java.com.djrapitops.plan.Log; +import org.bukkit.Bukkit; import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; import org.json.simple.parser.ParseException; @@ -21,7 +24,7 @@ import java.util.List; */ public class DumpLog { - private List lines = new ArrayList<>(); + private final List lines = new ArrayList<>(); /** * Writes a header @@ -102,7 +105,31 @@ public class DumpLog { * @return The link to the Dump Log */ String upload() { - String content = this.toString(); + List parts = ImmutableList.copyOf(split()).reverse(); + + Bukkit.broadcast(parts.size() + "", "asdasd"); + + String lastLink = null; + for (String part : parts) { + if (lastLink != null) { + part += "\n" + lastLink; + Bukkit.broadcast("link not null " + lastLink, "asdasd"); + } + + lastLink = upload(part); + Bukkit.broadcast(lastLink, "asdasd"); + } + + return lastLink; + } + + /** + * Uploads the content to Hastebin using HTTPS and POST + * + * @param content The content + * @return The link to the content + */ + private String upload(String content) { HttpsURLConnection connection = null; try { URL url = new URL("https://hastebin.com/documents"); @@ -116,13 +143,16 @@ public class DumpLog { connection.setDoOutput(true); DataOutputStream wr = new DataOutputStream(connection.getOutputStream()); - wr.writeBytes(this.toString()); + wr.writeBytes(content); wr.flush(); wr.close(); - BufferedReader rd = new BufferedReader(new InputStreamReader(connection.getInputStream())); + BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); + + String response = reader.readLine(); + JSONParser parser = new JSONParser(); - JSONObject json = (JSONObject) parser.parse(rd.readLine()); + JSONObject json = (JSONObject) parser.parse(response); return "https://hastebin.com/" + json.get("key"); } catch (IOException | ParseException e) { @@ -135,6 +165,10 @@ public class DumpLog { } } + private Iterable split() { + return Splitter.fixedLength(390000).split(this.toString()); + } + @Override public String toString() { return String.join("\n", lines); diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/file/dump/DumpUtils.java b/Plan/src/main/java/com/djrapitops/plan/utilities/file/dump/DumpUtils.java index 33bc82172..905679e64 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/file/dump/DumpUtils.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/file/dump/DumpUtils.java @@ -247,7 +247,7 @@ public class DumpUtils { * @throws IOException when an error while reading occurred */ private static void addErrorLog(DumpLog log, Plan plan) throws IOException { - Path errorFile = FileSystems.getDefault().getPath(plan.getDataFolder().getAbsolutePath(), Log.getErrorsFilename()); + Path errorFile = FileSystems.getDefault().getPath(plan.getDataFolder().getAbsolutePath(), "Errors.txt"); if (Files.notExists(errorFile)) { return; From e81f92d0d08cc0d3607429e8156639427abf6970 Mon Sep 17 00:00:00 2001 From: Fuzzlemann Date: Fri, 11 Aug 2017 18:04:54 +0200 Subject: [PATCH 03/12] Adds Javadoc for DumpLog#split --- .../com/djrapitops/plan/utilities/file/dump/DumpLog.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/file/dump/DumpLog.java b/Plan/src/main/java/com/djrapitops/plan/utilities/file/dump/DumpLog.java index a89efa022..eb7c2a190 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/file/dump/DumpLog.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/file/dump/DumpLog.java @@ -165,6 +165,11 @@ public class DumpLog { } } + /** + * Splits the content of the DumpLog into parts + * + * @return The splitted content + */ private Iterable split() { return Splitter.fixedLength(390000).split(this.toString()); } From b91ff72f55d1ba4b979c6f90420198aa6d0b613f Mon Sep 17 00:00:00 2001 From: Fuzzlemann Date: Fri, 11 Aug 2017 18:09:22 +0200 Subject: [PATCH 04/12] Removes debug messages that were accidentally not removed --- .../com/djrapitops/plan/utilities/file/dump/DumpLog.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/file/dump/DumpLog.java b/Plan/src/main/java/com/djrapitops/plan/utilities/file/dump/DumpLog.java index eb7c2a190..bdaa55a54 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/file/dump/DumpLog.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/file/dump/DumpLog.java @@ -3,7 +3,6 @@ package main.java.com.djrapitops.plan.utilities.file.dump; import com.google.common.base.Splitter; import com.google.common.collect.ImmutableList; import main.java.com.djrapitops.plan.Log; -import org.bukkit.Bukkit; import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; import org.json.simple.parser.ParseException; @@ -107,17 +106,13 @@ public class DumpLog { String upload() { List parts = ImmutableList.copyOf(split()).reverse(); - Bukkit.broadcast(parts.size() + "", "asdasd"); - String lastLink = null; for (String part : parts) { if (lastLink != null) { part += "\n" + lastLink; - Bukkit.broadcast("link not null " + lastLink, "asdasd"); } lastLink = upload(part); - Bukkit.broadcast(lastLink, "asdasd"); } return lastLink; From a7b27d7b0bf107a90711fc44e7262d5acb9eed12 Mon Sep 17 00:00:00 2001 From: Fuzzlemann Date: Fri, 11 Aug 2017 18:19:26 +0200 Subject: [PATCH 05/12] Replace Statement with Expression lambda --- .../com/djrapitops/plan/utilities/analysis/ExportUtility.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/analysis/ExportUtility.java b/Plan/src/main/java/com/djrapitops/plan/utilities/analysis/ExportUtility.java index 5561ca666..e7082236b 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/analysis/ExportUtility.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/analysis/ExportUtility.java @@ -72,9 +72,7 @@ public class ExportUtility { Log.debug("Export", "Player html files."); Log.debug("Export", "Player Page Folder: " + playersFolder.getAbsolutePath()); String playerHtml = HtmlUtils.getStringFromResource("player.html"); - rawData.forEach(userData -> { - writeInspectHtml(userData, playersFolder, playerHtml); - }); + rawData.forEach(userData -> writeInspectHtml(userData, playersFolder, playerHtml)); } catch (IOException ex) { Log.toLog("ExportUtils.export", ex); } finally { From 2a5a67178690a49ca707e9c7a709fd11e24cf08c Mon Sep 17 00:00:00 2001 From: Fuzzlemann Date: Sat, 12 Aug 2017 00:27:34 +0200 Subject: [PATCH 06/12] Put Benchmark.stop into finally clause --- .../plan/command/commands/ManageCommand.java | 2 +- .../com/djrapitops/plan/locale/Locale.java | 4 +-- .../plan/utilities/analysis/Analysis.java | 2 +- .../utilities/analysis/ExportUtility.java | 26 ++++++++++++------- 4 files changed, 21 insertions(+), 13 deletions(-) diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/ManageCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/ManageCommand.java index 3ca20ae3c..ae8421dd6 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/ManageCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/ManageCommand.java @@ -24,7 +24,7 @@ public class ManageCommand extends TreeCommand { * @param plugin Current instance of Plan */ public ManageCommand(Plan plugin) { - super(plugin, "manage,m", CommandType.CONSOLE, Permissions.MANAGE.getPermission(), Locale.get(Msg.CMD_USG_MANAGE) + "", "plan m"); + super(plugin, "manage,m", CommandType.CONSOLE, Permissions.MANAGE.getPermission(), Locale.get(Msg.CMD_USG_MANAGE).toString(), "plan m"); } diff --git a/Plan/src/main/java/com/djrapitops/plan/locale/Locale.java b/Plan/src/main/java/com/djrapitops/plan/locale/Locale.java index bdd93b08a..346471e3b 100644 --- a/Plan/src/main/java/com/djrapitops/plan/locale/Locale.java +++ b/Plan/src/main/java/com/djrapitops/plan/locale/Locale.java @@ -62,9 +62,9 @@ public class Locale implements Closeable { } } catch (IOException e) { Log.toLog(this.getClass().getName(), e); - + } finally { + Benchmark.stop("Enable", "Initializing locale"); } - Benchmark.stop("Enable", "Initializing locale"); } private void writeNewDefaultLocale() throws IOException { diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/analysis/Analysis.java b/Plan/src/main/java/com/djrapitops/plan/utilities/analysis/Analysis.java index cb8cfb81b..aab2532e6 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/analysis/Analysis.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/analysis/Analysis.java @@ -167,7 +167,7 @@ public class Analysis { PageCacheHandler.cachePage("analysisPage", () -> new AnalysisPageResponse(plugin.getUiServer().getDataReqHandler())); PageCacheHandler.cachePage("players", () -> new PlayersPageResponse(plugin)); - ExportUtility.export(plugin, analysisData, rawData); + ExportUtility.export(analysisData, rawData); } catch (Exception e) { Log.toLog(this.getClass().getName(), e); plugin.processStatus().setStatus("Analysis", "Error: " + e); diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/analysis/ExportUtility.java b/Plan/src/main/java/com/djrapitops/plan/utilities/analysis/ExportUtility.java index e7082236b..d2aee8737 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/analysis/ExportUtility.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/analysis/ExportUtility.java @@ -54,25 +54,31 @@ public class ExportUtility { } /** - * @param plugin * @param analysisData * @param rawData */ - public static void export(Plan plugin, AnalysisData analysisData, List rawData) { + public static void export(AnalysisData analysisData, List rawData) { if (!Settings.ANALYSIS_EXPORT.isTrue()) { return; } + Benchmark.start("Exporting Html pages"); try { File folder = getFolder(); Log.debug("Export", "Folder: " + folder.getAbsolutePath()); + writePlayersPageHtml(rawData, new File(folder, "players")); writeAnalysisHtml(analysisData, new File(folder, "server")); + File playersFolder = getPlayersFolder(folder); Log.debug("Export", "Player html files."); Log.debug("Export", "Player Page Folder: " + playersFolder.getAbsolutePath()); + String playerHtml = HtmlUtils.getStringFromResource("player.html"); + + Benchmark.start("Exporting Player pages"); rawData.forEach(userData -> writeInspectHtml(userData, playersFolder, playerHtml)); + Benchmark.stop("Exporting Player pages"); } catch (IOException ex) { Log.toLog("ExportUtils.export", ex); } finally { @@ -94,17 +100,18 @@ public class ExportUtility { /** * @param userData * @param playersFolder - * @throws FileNotFoundException - * @throws IOException */ - public static boolean writeInspectHtml(UserData userData, File playersFolder, String playerHtml) { + public static void writeInspectHtml(UserData userData, File playersFolder, String playerHtml) { if (!Settings.ANALYSIS_EXPORT.isTrue()) { - return false; + return; } + String name = userData.getName(); + if (name.endsWith(".")) { name = name.replace(".", "%2E"); } + if (name.endsWith(" ")) { name = name.replace(" ", "%20"); } @@ -112,16 +119,17 @@ public class ExportUtility { try { String inspectHtml = HtmlUtils.replacePlaceholders(playerHtml, PlaceholderUtils.getInspectReplaceRules(userData)); + File playerFolder = new File(playersFolder, name); playerFolder.mkdirs(); + File inspectHtmlFile = new File(playerFolder, "index.html"); inspectHtmlFile.createNewFile(); + Files.write(inspectHtmlFile.toPath(), Collections.singletonList(inspectHtml)); } catch (IOException e) { - Log.toLog("Export.inspectPage: " + name, e); - return false; + Log.toLog("Export.writeInspectHtml: " + name, e); } - return true; } /** From a1e87089bb85f642ad00a785a56c03e81e241319 Mon Sep 17 00:00:00 2001 From: Fuzzlemann Date: Sat, 12 Aug 2017 00:29:47 +0200 Subject: [PATCH 07/12] Change Locale#getMessage to using HashMap#getOrDefault --- Plan/src/main/java/com/djrapitops/plan/locale/Locale.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Plan/src/main/java/com/djrapitops/plan/locale/Locale.java b/Plan/src/main/java/com/djrapitops/plan/locale/Locale.java index 346471e3b..650fd252b 100644 --- a/Plan/src/main/java/com/djrapitops/plan/locale/Locale.java +++ b/Plan/src/main/java/com/djrapitops/plan/locale/Locale.java @@ -316,8 +316,7 @@ public class Locale implements Closeable { } public Message getMessage(Msg msg) { - Message message = messages.get(msg); - return message != null ? message : new Message(""); + return messages.getOrDefault(msg, new Message("")); } @Override From 26c3cd45aa689222448cda857ebe01c3358f5b48 Mon Sep 17 00:00:00 2001 From: Fuzzlemann Date: Sat, 12 Aug 2017 00:32:20 +0200 Subject: [PATCH 08/12] Change variable / method names to match Java Conventions --- .../com/djrapitops/plan/locale/Locale.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Plan/src/main/java/com/djrapitops/plan/locale/Locale.java b/Plan/src/main/java/com/djrapitops/plan/locale/Locale.java index 650fd252b..a51ab9f10 100644 --- a/Plan/src/main/java/com/djrapitops/plan/locale/Locale.java +++ b/Plan/src/main/java/com/djrapitops/plan/locale/Locale.java @@ -39,7 +39,7 @@ public class Locale implements Closeable { private final Map messages; public Locale(Plan plugin) { - LocaleHolder.setLOCALE(this); + LocaleHolder.setLocale(this); this.plugin = plugin; messages = new HashMap<>(); } @@ -322,18 +322,18 @@ public class Locale implements Closeable { @Override public void close() { messages.clear(); - LocaleHolder.LOCALE = null; + LocaleHolder.locale = null; } public static void unload() { - Locale locale = LocaleHolder.getLOCALE(); + Locale locale = LocaleHolder.getLocale(); if (locale != null) { locale.close(); } } public static Message get(Msg msg) { - Locale locale = LocaleHolder.getLOCALE(); + Locale locale = LocaleHolder.getLocale(); if (locale == null) { throw new IllegalStateException("Locale has not been initialized."); } @@ -342,14 +342,14 @@ public class Locale implements Closeable { private static class LocaleHolder { - private static Locale LOCALE; + private static Locale locale; - public static void setLOCALE(Locale LOCALE) { - LocaleHolder.LOCALE = LOCALE; + public static void setLocale(Locale locale) { + LocaleHolder.locale = locale; } - public static Locale getLOCALE() { - return LOCALE; + public static Locale getLocale() { + return locale; } } } From c95b72239e8e6eea85932c13fee97c2b000e3bb8 Mon Sep 17 00:00:00 2001 From: Fuzzlemann Date: Sat, 12 Aug 2017 00:45:58 +0200 Subject: [PATCH 09/12] Add Identifiers Change DataCacheGetQueue#containsUUIDToBeCached --- .../plan/data/cache/queue/DataCacheGetQueue.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Plan/src/main/java/com/djrapitops/plan/data/cache/queue/DataCacheGetQueue.java b/Plan/src/main/java/com/djrapitops/plan/data/cache/queue/DataCacheGetQueue.java index 395287619..7c311a3d9 100644 --- a/Plan/src/main/java/com/djrapitops/plan/data/cache/queue/DataCacheGetQueue.java +++ b/Plan/src/main/java/com/djrapitops/plan/data/cache/queue/DataCacheGetQueue.java @@ -27,7 +27,7 @@ public class DataCacheGetQueue extends Queue * @param plugin current instance of Plan */ public DataCacheGetQueue(Plan plugin) { - super(new ArrayBlockingQueue(Settings.PROCESS_GET_LIMIT.getNumber())); + super(new ArrayBlockingQueue<>(Settings.PROCESS_GET_LIMIT.getNumber())); setup = new GetSetup(queue, plugin.getDB()); setup.go(); } @@ -50,8 +50,12 @@ public class DataCacheGetQueue extends Queue } } - public boolean containsUUIDtoBeCached(UUID uuid) { - return uuid != null && new ArrayList<>(queue).stream().anyMatch(map -> (map.get(uuid) != null && map.get(uuid).size() >= 2)); + boolean containsUUIDtoBeCached(UUID uuid) { + return uuid != null + && queue.stream() + .map(map -> map.get(uuid)) + .filter(Objects::nonNull) + .anyMatch(list -> list.size() >= 2); } } @@ -59,7 +63,7 @@ class GetConsumer extends Consumer>> { private Database db; - GetConsumer(BlockingQueue q, Database db) { + GetConsumer(BlockingQueue>> q, Database db) { super(q, "GetQueueConsumer"); this.db = db; } From d8c42faaca40552ae28e40a0ff16d389861c68e0 Mon Sep 17 00:00:00 2001 From: Fuzzlemann Date: Sat, 12 Aug 2017 00:50:16 +0200 Subject: [PATCH 10/12] Add some more Identifiers Inline one variable --- .../plan/data/cache/queue/DataCacheClearQueue.java | 6 +++--- Plan/src/main/resources/player.html | 4 +--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Plan/src/main/java/com/djrapitops/plan/data/cache/queue/DataCacheClearQueue.java b/Plan/src/main/java/com/djrapitops/plan/data/cache/queue/DataCacheClearQueue.java index 987888f71..6a2733742 100644 --- a/Plan/src/main/java/com/djrapitops/plan/data/cache/queue/DataCacheClearQueue.java +++ b/Plan/src/main/java/com/djrapitops/plan/data/cache/queue/DataCacheClearQueue.java @@ -27,7 +27,7 @@ public class DataCacheClearQueue extends Queue { * @param handler current instance of DataCacheHandler. */ public DataCacheClearQueue(DataCacheHandler handler) { - super(new ArrayBlockingQueue(Settings.PROCESS_CLEAR_LIMIT.getNumber())); + super(new ArrayBlockingQueue<>(Settings.PROCESS_CLEAR_LIMIT.getNumber())); setup = new ClearSetup(queue, handler); setup.go(); } @@ -65,7 +65,7 @@ class ClearConsumer extends Consumer implements Runnable { private DataCacheHandler handler; - ClearConsumer(BlockingQueue q, DataCacheHandler handler) { + ClearConsumer(BlockingQueue q, DataCacheHandler handler) { super(q, "ClearQueueConsumer"); this.handler = handler; } @@ -97,7 +97,7 @@ class ClearConsumer extends Consumer implements Runnable { class ClearSetup extends Setup { - public ClearSetup(BlockingQueue q, DataCacheHandler handler) { + ClearSetup(BlockingQueue q, DataCacheHandler handler) { super(new ClearConsumer(q, handler)); } } diff --git a/Plan/src/main/resources/player.html b/Plan/src/main/resources/player.html index 0377f1beb..ce840bbca 100644 --- a/Plan/src/main/resources/player.html +++ b/Plan/src/main/resources/player.html @@ -770,9 +770,7 @@ var begin = new Date(%refreshlong%); var seconds = now.getTime() - begin.getTime(); - var out = formatTime(seconds); - - document.getElementById('divTime').innerHTML = out; + document.getElementById('divTime').innerHTML = formatTime(seconds); setTimeout('countUpTimer()', 1000); } From 2365ac2cc7fcfeccbf3b58202f1fbfac55d923a6 Mon Sep 17 00:00:00 2001 From: Fuzzlemann Date: Sat, 12 Aug 2017 00:52:42 +0200 Subject: [PATCH 11/12] Remove unnecessary throw --- Plan/src/test/java/utils/MockUtils.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Plan/src/test/java/utils/MockUtils.java b/Plan/src/test/java/utils/MockUtils.java index a53069cfb..70db22851 100644 --- a/Plan/src/test/java/utils/MockUtils.java +++ b/Plan/src/test/java/utils/MockUtils.java @@ -16,7 +16,6 @@ import org.bukkit.entity.Player; import org.mockito.Mockito; import org.powermock.api.mockito.PowerMockito; -import java.io.IOException; import java.net.InetAddress; import java.net.InetSocketAddress; import java.util.HashSet; @@ -154,7 +153,7 @@ public class MockUtils { return PowerMockito.mock(CommandSender.class); } - public static HttpServer mockHTTPServer() throws IOException { + public static HttpServer mockHTTPServer() { HttpServer httpServer = PowerMockito.mock(HttpServer.class); when(httpServer.getAddress()).thenReturn(new InetSocketAddress(80)); when(httpServer.getExecutor()).thenReturn(command -> System.out.println("HTTP Server command received")); From 94e1003fcf110b3e7421f22f321370c7cc580101 Mon Sep 17 00:00:00 2001 From: Fuzzlemann Date: Sat, 12 Aug 2017 01:00:25 +0200 Subject: [PATCH 12/12] Remove unnecessary comments Change some == to === in JS Code --- Plan/src/main/java/com/djrapitops/plan/ui/text/TextUI.java | 4 ++-- Plan/src/main/resources/player.html | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Plan/src/main/java/com/djrapitops/plan/ui/text/TextUI.java b/Plan/src/main/java/com/djrapitops/plan/ui/text/TextUI.java index 6d768862f..08fafbe8c 100644 --- a/Plan/src/main/java/com/djrapitops/plan/ui/text/TextUI.java +++ b/Plan/src/main/java/com/djrapitops/plan/ui/text/TextUI.java @@ -84,12 +84,12 @@ public class TextUI { final TPSPart tps = d.getTpsPart(); return new String[]{ ball + " Total Players: " + sec + count.getPlayerCount(), - // + ball + " Active: " + sec + activity.getActive().size() + main + " Inactive: " + sec + activity.getInactive().size() + main + " Single Join: " + sec + activity.getJoinedOnce().size() + main + " Banned: " + sec + activity.getBans().size(), - // + ball + " New Players 24h: " + sec + join.get("npday") + main + " 7d: " + sec + d.get("npweek") + main + " 30d: " + sec + d.get("npmonth"), "", ball + " Total Playtime: " + sec + playtime.get("totalplaytime") + main + " Player Avg: " + sec + playtime.get("avgplaytime"), diff --git a/Plan/src/main/resources/player.html b/Plan/src/main/resources/player.html index ce840bbca..8c84c7d05 100644 --- a/Plan/src/main/resources/player.html +++ b/Plan/src/main/resources/player.html @@ -741,12 +741,12 @@ function openFunc(i) { return function() { - if (window.getComputedStyle(document.getElementById("navbutton")).getPropertyValue('display') == "inline") { + if (window.getComputedStyle(document.getElementById("navbutton")).getPropertyValue('display') === "inline") { closeNav(); } var max = navButtons.length; for (var j = 0; j < max; j++) { - if (j == i) { + if (j === i) { navButtons[j].classList.add('active'); continue; }