From 2b19983055a7b0cc2e62152dd3fc0ca6b8c568eb Mon Sep 17 00:00:00 2001 From: Rsl1122 Date: Fri, 25 May 2018 12:26:14 +0300 Subject: [PATCH] Fixed some IntelliJ inspection things --- .../com/djrapitops/plan/command/commands/ManageCommand.java | 2 +- .../djrapitops/plan/command/commands/RegisterCommand.java | 2 -- .../plan/command/commands/manage/ManageClearCommand.java | 6 +----- .../com/djrapitops/plan/data/element/AnalysisContainer.java | 4 ++-- .../main/java/com/djrapitops/plan/system/BukkitSystem.java | 3 +-- .../main/java/com/djrapitops/plan/system/BungeeSystem.java | 2 +- .../main/java/com/djrapitops/plan/system/PlanSystem.java | 4 ++++ .../main/java/com/djrapitops/plan/system/SpongeSystem.java | 2 +- .../java/com/djrapitops/plan/system/cache/SessionCache.java | 2 +- .../plan/system/database/databases/sql/SQLDB.java | 2 +- .../system/database/databases/sql/tables/SessionsTable.java | 2 +- .../system/database/databases/sql/tables/WorldTable.java | 2 +- .../system/webserver/response/pages/DebugPageResponse.java | 2 +- .../djrapitops/plan/utilities/html/tables/ActionsTable.java | 2 +- .../plan/utilities/html/tables/PlayersTableCreator.java | 2 +- 15 files changed, 18 insertions(+), 21 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 1f5b674ad..8db09c39c 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 @@ -29,7 +29,7 @@ public class ManageCommand extends TreeCmdNode { new ManageRestoreCommand(plugin), new ManageRemoveCommand(), new ManageHotSwapCommand(plugin), - new ManageClearCommand(plugin), + new ManageClearCommand(), }, new CommandNode[]{ new ManageSetupCommand(), diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/RegisterCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/RegisterCommand.java index 2d7187dcf..9be47f81c 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/RegisterCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/RegisterCommand.java @@ -33,7 +33,6 @@ public class RegisterCommand extends CommandNode { private final String notEnoughArgsMsg; private final String hashErrorMsg; - private final String permLvlErrorMsg; public RegisterCommand() { // No Permission Requirement @@ -47,7 +46,6 @@ public class RegisterCommand extends CommandNode { notEnoughArgsMsg = Locale.get(Msg.CMD_FAIL_REQ_ARGS).parse("(3) " + Arrays.toString(getArguments())); hashErrorMsg = "§cPassword hash error."; - permLvlErrorMsg = "§cIncorrect perm level, not a number: "; } @Override diff --git a/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageClearCommand.java b/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageClearCommand.java index e22365416..b42b4b419 100644 --- a/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageClearCommand.java +++ b/Plan/src/main/java/com/djrapitops/plan/command/commands/manage/ManageClearCommand.java @@ -1,6 +1,5 @@ package com.djrapitops.plan.command.commands.manage; -import com.djrapitops.plan.PlanPlugin; import com.djrapitops.plan.api.exceptions.database.DBException; import com.djrapitops.plan.api.exceptions.database.DBInitException; import com.djrapitops.plan.api.exceptions.database.FatalDBException; @@ -25,14 +24,11 @@ import com.djrapitops.plugin.utilities.Verify; */ public class ManageClearCommand extends CommandNode { - private final PlanPlugin plugin; - - public ManageClearCommand(PlanPlugin plugin) { + public ManageClearCommand() { super("clear", Permissions.MANAGE.getPermission(), CommandType.PLAYER_OR_ARGS); setShortHelp(Locale.get(Msg.CMD_USG_MANAGE_CLEAR).toString()); setArguments("", "[-a]"); setInDepthHelp(Locale.get(Msg.CMD_HELP_MANAGE_CLEAR).toArray()); - this.plugin = plugin; } diff --git a/Plan/src/main/java/com/djrapitops/plan/data/element/AnalysisContainer.java b/Plan/src/main/java/com/djrapitops/plan/data/element/AnalysisContainer.java index 2efb126ef..03d278ae6 100644 --- a/Plan/src/main/java/com/djrapitops/plan/data/element/AnalysisContainer.java +++ b/Plan/src/main/java/com/djrapitops/plan/data/element/AnalysisContainer.java @@ -30,13 +30,13 @@ import java.util.UUID; */ public final class AnalysisContainer extends InspectContainer { - private TreeMap> playerTableValues; + private Map> playerTableValues; public AnalysisContainer() { playerTableValues = new TreeMap<>(); } - public TreeMap> getPlayerTableValues() { + public Map> getPlayerTableValues() { return playerTableValues; } diff --git a/Plan/src/main/java/com/djrapitops/plan/system/BukkitSystem.java b/Plan/src/main/java/com/djrapitops/plan/system/BukkitSystem.java index dc22a04e3..21d2ee449 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/BukkitSystem.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/BukkitSystem.java @@ -30,8 +30,7 @@ import com.djrapitops.plugin.api.utility.log.Log; public class BukkitSystem extends PlanSystem implements ServerSystem { public BukkitSystem(Plan plugin) { - - testSystem = this; + setTestSystem(this); Log.setErrorManager(new PlanErrorManager()); diff --git a/Plan/src/main/java/com/djrapitops/plan/system/BungeeSystem.java b/Plan/src/main/java/com/djrapitops/plan/system/BungeeSystem.java index 087ed82ab..181d6a6bb 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/BungeeSystem.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/BungeeSystem.java @@ -29,7 +29,7 @@ import com.djrapitops.plugin.api.utility.log.Log; public class BungeeSystem extends PlanSystem { public BungeeSystem(PlanBungee plugin) { - testSystem = this; + setTestSystem(this); Log.setErrorManager(new PlanErrorManager()); diff --git a/Plan/src/main/java/com/djrapitops/plan/system/PlanSystem.java b/Plan/src/main/java/com/djrapitops/plan/system/PlanSystem.java index 516dd7b02..07cb7bc07 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/PlanSystem.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/PlanSystem.java @@ -196,4 +196,8 @@ public abstract class PlanSystem implements SubSystem { public Processing getProcessing() { return processing; } + + static void setTestSystem(PlanSystem testSystem) { + PlanSystem.testSystem = testSystem; + } } \ No newline at end of file diff --git a/Plan/src/main/java/com/djrapitops/plan/system/SpongeSystem.java b/Plan/src/main/java/com/djrapitops/plan/system/SpongeSystem.java index 7bfb57173..452cc5992 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/SpongeSystem.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/SpongeSystem.java @@ -32,7 +32,7 @@ public class SpongeSystem extends PlanSystem implements ServerSystem { private boolean firstInstall = false; public SpongeSystem(PlanSponge plugin) { - testSystem = this; + setTestSystem(this); Log.setErrorManager(new PlanErrorManager()); diff --git a/Plan/src/main/java/com/djrapitops/plan/system/cache/SessionCache.java b/Plan/src/main/java/com/djrapitops/plan/system/cache/SessionCache.java index acf2e5ab5..a13f3d62a 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/cache/SessionCache.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/cache/SessionCache.java @@ -29,7 +29,7 @@ public class SessionCache { } public static SessionCache getInstance() { - DataCache dataCache = CacheSystem.getInstance().getDataCache(); + SessionCache dataCache = CacheSystem.getInstance().getDataCache(); Verify.nullCheck(dataCache, () -> new IllegalStateException("Data Cache was not initialized.")); return dataCache; } diff --git a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/SQLDB.java b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/SQLDB.java index c8d28b54a..885a11019 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/SQLDB.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/SQLDB.java @@ -373,7 +373,7 @@ public abstract class SQLDB extends Database { } public boolean isUsingMySQL() { - return this instanceof MySQLDB; + return usingMySQL; } @Override diff --git a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/SessionsTable.java b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/SessionsTable.java index be0d52144..6079fc625 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/SessionsTable.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/SessionsTable.java @@ -760,7 +760,7 @@ public class SessionsTable extends UserIDTable { return query(new QueryAllStatement>(sql, 10000) { @Override public Map processResults(ResultSet set) throws SQLException { - HashMap idServerIdMap = new HashMap<>(); + Map idServerIdMap = new HashMap<>(); while (set.next()) { idServerIdMap.put(set.getInt(Col.ID.get()), set.getInt(Col.SERVER_ID.get())); } diff --git a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/WorldTable.java b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/WorldTable.java index 17ff9830f..826d870de 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/WorldTable.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/database/databases/sql/tables/WorldTable.java @@ -310,7 +310,7 @@ public class WorldTable extends Table { return query(new QueryAllStatement>>(sql, 100) { @Override public Map> processResults(ResultSet set) throws SQLException { - HashMap> map = new HashMap<>(); + Map> map = new HashMap<>(); while (set.next()) { int serverID = set.getInt(Col.SERVER_ID.get()); diff --git a/Plan/src/main/java/com/djrapitops/plan/system/webserver/response/pages/DebugPageResponse.java b/Plan/src/main/java/com/djrapitops/plan/system/webserver/response/pages/DebugPageResponse.java index 23e7a81a1..98c3542b8 100644 --- a/Plan/src/main/java/com/djrapitops/plan/system/webserver/response/pages/DebugPageResponse.java +++ b/Plan/src/main/java/com/djrapitops/plan/system/webserver/response/pages/DebugPageResponse.java @@ -185,7 +185,7 @@ public class DebugPageResponse extends ErrorResponse { try { content.append("
### Logged Errors
"); - TreeMap> errors = ErrorLogger.getLoggedErrors(PlanPlugin.getInstance()); + SortedMap> errors = ErrorLogger.getLoggedErrors(PlanPlugin.getInstance()); if (!errors.isEmpty()) { List errorLines = new ArrayList<>(); diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/html/tables/ActionsTable.java b/Plan/src/main/java/com/djrapitops/plan/utilities/html/tables/ActionsTable.java index fefbd24dd..ca4a672d7 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/html/tables/ActionsTable.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/html/tables/ActionsTable.java @@ -28,7 +28,7 @@ public class ActionsTable extends TableContainer { } } - private void addValues(List actions) { + private void addValues(Iterable actions) { int i = 0; for (Action action : actions) { if (i > 50) { diff --git a/Plan/src/main/java/com/djrapitops/plan/utilities/html/tables/PlayersTableCreator.java b/Plan/src/main/java/com/djrapitops/plan/utilities/html/tables/PlayersTableCreator.java index 50dec72ab..030421a9a 100644 --- a/Plan/src/main/java/com/djrapitops/plan/utilities/html/tables/PlayersTableCreator.java +++ b/Plan/src/main/java/com/djrapitops/plan/utilities/html/tables/PlayersTableCreator.java @@ -85,7 +85,7 @@ public class PlayersTableCreator { return html.toString(); } - public static String createPluginsTable(Map containers, List players) { + public static String createPluginsTable(Map containers, Collection players) { TreeMap> data = new TreeMap<>(); for (AnalysisContainer container : containers.values()) { if (!container.hasPlayerTableValues()) {