From f1ae1c3f8fefabd3808bef2b9693785efaaceb7f Mon Sep 17 00:00:00 2001 From: Fuzzlemann Date: Sun, 23 Jul 2017 14:07:47 +0200 Subject: [PATCH] Removes redundant casts and array creations --- .../djrapitops/plan/data/listeners/PlanDeathEventListener.java | 2 +- .../djrapitops/plan/ui/html/graphs/PunchCardGraphCreator.java | 2 +- .../java/com/djrapitops/plan/utilities/NewPlayerCreator.java | 2 +- .../plan/utilities/analysis/DouglasPeckerAlgorithm.java | 2 +- .../com/djrapitops/plan/utilities/analysis/ExportUtility.java | 2 +- .../main/java/com/djrapitops/plan/database/DatabaseTest.java | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Plan/src/main/java/com/djrapitops/plan/data/listeners/PlanDeathEventListener.java b/Plan/src/main/java/com/djrapitops/plan/data/listeners/PlanDeathEventListener.java index 203cd1129..2960894d8 100644 --- a/Plan/src/main/java/com/djrapitops/plan/data/listeners/PlanDeathEventListener.java +++ b/Plan/src/main/java/com/djrapitops/plan/data/listeners/PlanDeathEventListener.java @@ -58,7 +58,7 @@ public class PlanDeathEventListener implements Listener { handler.addToPool(new KillInfo(killer.getUniqueId(), time, dead, itemInHand.name())); } if (dead instanceof Player) { - handler.addToPool(new DeathInfo(((Player) dead).getUniqueId())); + handler.addToPool(new DeathInfo(dead.getUniqueId())); } } } diff --git a/Plan/src/main/java/com/djrapitops/plan/ui/html/graphs/PunchCardGraphCreator.java b/Plan/src/main/java/com/djrapitops/plan/ui/html/graphs/PunchCardGraphCreator.java index f5f8e5ed8..7e4b69143 100644 --- a/Plan/src/main/java/com/djrapitops/plan/ui/html/graphs/PunchCardGraphCreator.java +++ b/Plan/src/main/java/com/djrapitops/plan/ui/html/graphs/PunchCardGraphCreator.java @@ -74,7 +74,7 @@ public class PunchCardGraphCreator { for (int j = 0; j < 24; j++) { int value = dataArray[i][j]; if (value - avg > 3 * standardDiviation) { - dataArray[i][j] = (int) (avg); + dataArray[i][j] = avg; } } } diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/NewPlayerCreator.java b/Plan/src/main/java/com/djrapitops/plan/utilities/NewPlayerCreator.java index 4d1b78aff..efe12999c 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/NewPlayerCreator.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/NewPlayerCreator.java @@ -18,7 +18,7 @@ public class NewPlayerCreator { * @return a new UserData object */ public static UserData createNewPlayer(IPlayer player) { - return createNewPlayer((IOfflinePlayer) player, player.getGamemode()); + return createNewPlayer(player, player.getGamemode()); } /** diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/analysis/DouglasPeckerAlgorithm.java b/Plan/src/main/java/com/djrapitops/plan/utilities/analysis/DouglasPeckerAlgorithm.java index a3cb912df..97d825d74 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/analysis/DouglasPeckerAlgorithm.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/analysis/DouglasPeckerAlgorithm.java @@ -45,7 +45,7 @@ public class DouglasPeckerAlgorithm { results.addAll(results1.subList(0, results1.size() - 1)); results.addAll(results2); } else { - return Arrays.asList(new Point[]{points.get(0), points.get(lastIndex)}); + return Arrays.asList(points.get(0), points.get(lastIndex)); } return results; } 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 9f984af75..416724248 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 @@ -132,7 +132,7 @@ public class ExportUtility { String playersHtml = PlayersPageResponse.buildContent(rawData); playersfolder.mkdirs(); File playersHtmlFile = new File(playersfolder, "index.html"); - Files.write(playersHtmlFile.toPath(), Arrays.asList(new String[]{playersHtml})); + Files.write(playersHtmlFile.toPath(), Arrays.asList(playersHtml)); } } diff --git a/Plan/src/test/java/main/java/com/djrapitops/plan/database/DatabaseTest.java b/Plan/src/test/java/main/java/com/djrapitops/plan/database/DatabaseTest.java index eea6bc182..3e3a5c2a0 100644 --- a/Plan/src/test/java/main/java/com/djrapitops/plan/database/DatabaseTest.java +++ b/Plan/src/test/java/main/java/com/djrapitops/plan/database/DatabaseTest.java @@ -194,7 +194,7 @@ public class DatabaseTest { c.put("/roiergbnougbierubieugbeigubeigubgierbgeugeg", 3); db.saveCommandUse(c); assertTrue(db.removeAllData()); - assertTrue("Contains the user", db.getUserDataForUUIDS(Arrays.asList(new UUID[]{MockUtils.getPlayerUUID(), MockUtils.getPlayer2UUID()})).isEmpty()); + assertTrue("Contains the user", db.getUserDataForUUIDS(Arrays.asList(MockUtils.getPlayerUUID(), MockUtils.getPlayer2UUID())).isEmpty()); assertTrue("Contains commandUse", db.getCommandUse().isEmpty()); }