Fixed some IntelliJ inspection things

This commit is contained in:
Rsl1122 2018-05-25 12:26:14 +03:00
parent f2cdd3804b
commit 2b19983055
15 changed files with 18 additions and 21 deletions

View File

@ -29,7 +29,7 @@ public class ManageCommand extends TreeCmdNode {
new ManageRestoreCommand(plugin), new ManageRestoreCommand(plugin),
new ManageRemoveCommand(), new ManageRemoveCommand(),
new ManageHotSwapCommand(plugin), new ManageHotSwapCommand(plugin),
new ManageClearCommand(plugin), new ManageClearCommand(),
}, },
new CommandNode[]{ new CommandNode[]{
new ManageSetupCommand(), new ManageSetupCommand(),

View File

@ -33,7 +33,6 @@ public class RegisterCommand extends CommandNode {
private final String notEnoughArgsMsg; private final String notEnoughArgsMsg;
private final String hashErrorMsg; private final String hashErrorMsg;
private final String permLvlErrorMsg;
public RegisterCommand() { public RegisterCommand() {
// No Permission Requirement // 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())); notEnoughArgsMsg = Locale.get(Msg.CMD_FAIL_REQ_ARGS).parse("(3) " + Arrays.toString(getArguments()));
hashErrorMsg = "§cPassword hash error."; hashErrorMsg = "§cPassword hash error.";
permLvlErrorMsg = "§cIncorrect perm level, not a number: ";
} }
@Override @Override

View File

@ -1,6 +1,5 @@
package com.djrapitops.plan.command.commands.manage; 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.DBException;
import com.djrapitops.plan.api.exceptions.database.DBInitException; import com.djrapitops.plan.api.exceptions.database.DBInitException;
import com.djrapitops.plan.api.exceptions.database.FatalDBException; import com.djrapitops.plan.api.exceptions.database.FatalDBException;
@ -25,14 +24,11 @@ import com.djrapitops.plugin.utilities.Verify;
*/ */
public class ManageClearCommand extends CommandNode { public class ManageClearCommand extends CommandNode {
private final PlanPlugin plugin; public ManageClearCommand() {
public ManageClearCommand(PlanPlugin plugin) {
super("clear", Permissions.MANAGE.getPermission(), CommandType.PLAYER_OR_ARGS); super("clear", Permissions.MANAGE.getPermission(), CommandType.PLAYER_OR_ARGS);
setShortHelp(Locale.get(Msg.CMD_USG_MANAGE_CLEAR).toString()); setShortHelp(Locale.get(Msg.CMD_USG_MANAGE_CLEAR).toString());
setArguments("<DB>", "[-a]"); setArguments("<DB>", "[-a]");
setInDepthHelp(Locale.get(Msg.CMD_HELP_MANAGE_CLEAR).toArray()); setInDepthHelp(Locale.get(Msg.CMD_HELP_MANAGE_CLEAR).toArray());
this.plugin = plugin;
} }

View File

@ -30,13 +30,13 @@ import java.util.UUID;
*/ */
public final class AnalysisContainer extends InspectContainer { public final class AnalysisContainer extends InspectContainer {
private TreeMap<String, Map<UUID, ? extends Serializable>> playerTableValues; private Map<String, Map<UUID, ? extends Serializable>> playerTableValues;
public AnalysisContainer() { public AnalysisContainer() {
playerTableValues = new TreeMap<>(); playerTableValues = new TreeMap<>();
} }
public TreeMap<String, Map<UUID, ? extends Serializable>> getPlayerTableValues() { public Map<String, Map<UUID, ? extends Serializable>> getPlayerTableValues() {
return playerTableValues; return playerTableValues;
} }

View File

@ -30,8 +30,7 @@ import com.djrapitops.plugin.api.utility.log.Log;
public class BukkitSystem extends PlanSystem implements ServerSystem { public class BukkitSystem extends PlanSystem implements ServerSystem {
public BukkitSystem(Plan plugin) { public BukkitSystem(Plan plugin) {
setTestSystem(this);
testSystem = this;
Log.setErrorManager(new PlanErrorManager()); Log.setErrorManager(new PlanErrorManager());

View File

@ -29,7 +29,7 @@ import com.djrapitops.plugin.api.utility.log.Log;
public class BungeeSystem extends PlanSystem { public class BungeeSystem extends PlanSystem {
public BungeeSystem(PlanBungee plugin) { public BungeeSystem(PlanBungee plugin) {
testSystem = this; setTestSystem(this);
Log.setErrorManager(new PlanErrorManager()); Log.setErrorManager(new PlanErrorManager());

View File

@ -196,4 +196,8 @@ public abstract class PlanSystem implements SubSystem {
public Processing getProcessing() { public Processing getProcessing() {
return processing; return processing;
} }
static void setTestSystem(PlanSystem testSystem) {
PlanSystem.testSystem = testSystem;
}
} }

View File

@ -32,7 +32,7 @@ public class SpongeSystem extends PlanSystem implements ServerSystem {
private boolean firstInstall = false; private boolean firstInstall = false;
public SpongeSystem(PlanSponge plugin) { public SpongeSystem(PlanSponge plugin) {
testSystem = this; setTestSystem(this);
Log.setErrorManager(new PlanErrorManager()); Log.setErrorManager(new PlanErrorManager());

View File

@ -29,7 +29,7 @@ public class SessionCache {
} }
public static SessionCache getInstance() { public static SessionCache getInstance() {
DataCache dataCache = CacheSystem.getInstance().getDataCache(); SessionCache dataCache = CacheSystem.getInstance().getDataCache();
Verify.nullCheck(dataCache, () -> new IllegalStateException("Data Cache was not initialized.")); Verify.nullCheck(dataCache, () -> new IllegalStateException("Data Cache was not initialized."));
return dataCache; return dataCache;
} }

View File

@ -373,7 +373,7 @@ public abstract class SQLDB extends Database {
} }
public boolean isUsingMySQL() { public boolean isUsingMySQL() {
return this instanceof MySQLDB; return usingMySQL;
} }
@Override @Override

View File

@ -760,7 +760,7 @@ public class SessionsTable extends UserIDTable {
return query(new QueryAllStatement<Map<Integer, Integer>>(sql, 10000) { return query(new QueryAllStatement<Map<Integer, Integer>>(sql, 10000) {
@Override @Override
public Map<Integer, Integer> processResults(ResultSet set) throws SQLException { public Map<Integer, Integer> processResults(ResultSet set) throws SQLException {
HashMap<Integer, Integer> idServerIdMap = new HashMap<>(); Map<Integer, Integer> idServerIdMap = new HashMap<>();
while (set.next()) { while (set.next()) {
idServerIdMap.put(set.getInt(Col.ID.get()), set.getInt(Col.SERVER_ID.get())); idServerIdMap.put(set.getInt(Col.ID.get()), set.getInt(Col.SERVER_ID.get()));
} }

View File

@ -310,7 +310,7 @@ public class WorldTable extends Table {
return query(new QueryAllStatement<Map<Integer, List<Integer>>>(sql, 100) { return query(new QueryAllStatement<Map<Integer, List<Integer>>>(sql, 100) {
@Override @Override
public Map<Integer, List<Integer>> processResults(ResultSet set) throws SQLException { public Map<Integer, List<Integer>> processResults(ResultSet set) throws SQLException {
HashMap<Integer, List<Integer>> map = new HashMap<>(); Map<Integer, List<Integer>> map = new HashMap<>();
while (set.next()) { while (set.next()) {
int serverID = set.getInt(Col.SERVER_ID.get()); int serverID = set.getInt(Col.SERVER_ID.get());

View File

@ -185,7 +185,7 @@ public class DebugPageResponse extends ErrorResponse {
try { try {
content.append("<pre>### Logged Errors<br>"); content.append("<pre>### Logged Errors<br>");
TreeMap<String, List<String>> errors = ErrorLogger.getLoggedErrors(PlanPlugin.getInstance()); SortedMap<String, List<String>> errors = ErrorLogger.getLoggedErrors(PlanPlugin.getInstance());
if (!errors.isEmpty()) { if (!errors.isEmpty()) {
List<String> errorLines = new ArrayList<>(); List<String> errorLines = new ArrayList<>();

View File

@ -28,7 +28,7 @@ public class ActionsTable extends TableContainer {
} }
} }
private void addValues(List<Action> actions) { private void addValues(Iterable<Action> actions) {
int i = 0; int i = 0;
for (Action action : actions) { for (Action action : actions) {
if (i > 50) { if (i > 50) {

View File

@ -85,7 +85,7 @@ public class PlayersTableCreator {
return html.toString(); return html.toString();
} }
public static String createPluginsTable(Map<PluginData, AnalysisContainer> containers, List<PlayerProfile> players) { public static String createPluginsTable(Map<PluginData, AnalysisContainer> containers, Collection<PlayerProfile> players) {
TreeMap<String, Map<UUID, ? extends Serializable>> data = new TreeMap<>(); TreeMap<String, Map<UUID, ? extends Serializable>> data = new TreeMap<>();
for (AnalysisContainer container : containers.values()) { for (AnalysisContainer container : containers.values()) {
if (!container.hasPlayerTableValues()) { if (!container.hasPlayerTableValues()) {