diff --git a/Plan/bukkit/src/main/java/com/djrapitops/plan/system/listeners/bukkit/DeathEventListener.java b/Plan/bukkit/src/main/java/com/djrapitops/plan/system/listeners/bukkit/DeathEventListener.java index 021039bcd..a6f0e773d 100644 --- a/Plan/bukkit/src/main/java/com/djrapitops/plan/system/listeners/bukkit/DeathEventListener.java +++ b/Plan/bukkit/src/main/java/com/djrapitops/plan/system/listeners/bukkit/DeathEventListener.java @@ -102,10 +102,10 @@ public class DeathEventListener implements Listener { Material itemInHand; try { itemInHand = killer.getInventory().getItemInMainHand().getType(); - } catch (NoSuchMethodError e) { + } catch (NoSuchMethodError oldVersion) { try { itemInHand = killer.getInventory().getItemInHand().getType(); // Support for non dual wielding versions. - } catch (Exception | NoSuchMethodError | NoSuchFieldError e2) { + } catch (Exception | NoSuchMethodError | NoSuchFieldError unknownError) { itemInHand = Material.AIR; } } diff --git a/Plan/common/src/main/java/com/djrapitops/plan/data/store/mutators/ActivityIndex.java b/Plan/common/src/main/java/com/djrapitops/plan/data/store/mutators/ActivityIndex.java index b372d6e1a..dd3ca8485 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/data/store/mutators/ActivityIndex.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/data/store/mutators/ActivityIndex.java @@ -72,17 +72,17 @@ public class ActivityIndex { double max = 4.0; long playtimeWeek = weekOne.toActivePlaytime(); - double weekPlay = (playtimeWeek * 1.0 / activePlayThreshold); + double weekPlay = playtimeWeek * 1.0 / activePlayThreshold; if (weekPlay > max) { weekPlay = max; } long playtimeWeek2 = weekTwo.toActivePlaytime(); - double week2Play = (playtimeWeek2 * 1.0 / activePlayThreshold); + double week2Play = playtimeWeek2 * 1.0 / activePlayThreshold; if (week2Play > max) { week2Play = max; } long playtimeWeek3 = weekThree.toActivePlaytime(); - double week3Play = (playtimeWeek3 * 1.0 / activePlayThreshold); + double week3Play = playtimeWeek3 * 1.0 / activePlayThreshold; if (week3Play > max) { week3Play = max; } diff --git a/Plan/common/src/main/java/com/djrapitops/plan/db/access/queries/objects/UserIdentifierQueries.java b/Plan/common/src/main/java/com/djrapitops/plan/db/access/queries/objects/UserIdentifierQueries.java index 351f68a44..1987c7c0e 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/db/access/queries/objects/UserIdentifierQueries.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/db/access/queries/objects/UserIdentifierQueries.java @@ -107,8 +107,8 @@ public class UserIdentifierQueries { public Map processResults(ResultSet set) throws SQLException { Map names = new HashMap<>(); while (set.next()) { - UUID uuid = UUID.fromString(set.getString((UsersTable.USER_UUID))); - String name = set.getString((UsersTable.USER_NAME)); + UUID uuid = UUID.fromString(set.getString(UsersTable.USER_UUID)); + String name = set.getString(UsersTable.USER_NAME); names.put(uuid, name); } diff --git a/Plan/common/src/main/java/com/djrapitops/plan/db/tasks/KeepAliveTask.java b/Plan/common/src/main/java/com/djrapitops/plan/db/tasks/KeepAliveTask.java index d7da6e779..fd5001b2e 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/db/tasks/KeepAliveTask.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/db/tasks/KeepAliveTask.java @@ -54,12 +54,12 @@ public class KeepAliveTask extends AbsRunnable { statement = connection.createStatement(); resultSet = statement.executeQuery("/* ping */ SELECT 1"); } - } catch (SQLException e) { + } catch (SQLException pingException) { logger.debug("Something went wrong during SQL Connection upkeep task."); try { connection = iReconnect.reconnect(); - } catch (SQLException e1) { - errorHandler.log(L.ERROR, this.getClass(), e1); + } catch (SQLException reconnectionError) { + errorHandler.log(L.ERROR, this.getClass(), reconnectionError); logger.error("SQL connection maintaining task had to be closed due to exception."); this.cancel(); } diff --git a/Plan/common/src/main/java/com/djrapitops/plan/system/info/InfoSystem.java b/Plan/common/src/main/java/com/djrapitops/plan/system/info/InfoSystem.java index a0a2fa502..7a7d115f9 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/system/info/InfoSystem.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/system/info/InfoSystem.java @@ -119,7 +119,7 @@ public abstract class InfoSystem implements SubSystem { try { logger.getDebugLogger().logOn(DebugChannels.INFO_REQUESTS, "Exception during request: " + original.toString() + ", running locally."); runLocally(infoRequest); - } catch (NoServersException e2) { + } catch (NoServersException noServers) { throw original; } } diff --git a/Plan/common/src/main/java/com/djrapitops/plan/system/webserver/response/ResponseFactory.java b/Plan/common/src/main/java/com/djrapitops/plan/system/webserver/response/ResponseFactory.java index 62eaffaba..7a2ac764b 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/system/webserver/response/ResponseFactory.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/system/webserver/response/ResponseFactory.java @@ -163,7 +163,7 @@ public class ResponseFactory { public ErrorResponse basicAuthFail(WebUserAuthException e) { try { return PromptAuthorizationResponse.getBasicAuthResponse(e, versionCheckSystem, files); - } catch (IOException e1) { + } catch (IOException jarReadFailed) { return internalErrorResponse(e, "Failed to parse PromptAuthorizationResponse"); } } diff --git a/Plan/common/src/main/java/com/djrapitops/plan/utilities/html/HtmlStructure.java b/Plan/common/src/main/java/com/djrapitops/plan/utilities/html/HtmlStructure.java index fad561be7..0a7629da0 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/utilities/html/HtmlStructure.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/utilities/html/HtmlStructure.java @@ -28,6 +28,10 @@ import org.apache.commons.text.TextStringBuilder; */ public class HtmlStructure { + private HtmlStructure() { + /* Static method class */ + } + public static String separateWithDots(String... elements) { TextStringBuilder builder = new TextStringBuilder(); builder.appendWithSeparators(elements, " • "); diff --git a/Plan/common/src/main/java/com/djrapitops/plan/utilities/html/graphs/line/Line.java b/Plan/common/src/main/java/com/djrapitops/plan/utilities/html/graphs/line/Line.java index 392bcc0db..767c7112b 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/utilities/html/graphs/line/Line.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/utilities/html/graphs/line/Line.java @@ -65,7 +65,7 @@ public class Line { double x2 = end.getX(); double y1 = start.getY(); double y2 = end.getY(); - return Math.sqrt(Math.pow((x2 - x1), 2) + (Math.pow((y2 - y1), 2))); + return Math.sqrt(Math.pow(x2 - x1, 2) + (Math.pow(y2 - y1, 2))); } public double getPerpendicularDistance(Point from) { diff --git a/Plan/common/src/main/java/com/djrapitops/plan/utilities/html/graphs/stack/ActivityStackGraph.java b/Plan/common/src/main/java/com/djrapitops/plan/utilities/html/graphs/stack/ActivityStackGraph.java index f34e3c1bc..db1596e00 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/utilities/html/graphs/stack/ActivityStackGraph.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/utilities/html/graphs/stack/ActivityStackGraph.java @@ -45,7 +45,7 @@ class ActivityStackGraph extends StackGraph { StackDataSet[] dataSets = new StackDataSet[groups.length]; for (int i = 0; i < groups.length; i++) { - dataSets[i] = new StackDataSet(new ArrayList<>(), groups[i], colors[(i) % maxCol]); + dataSets[i] = new StackDataSet(new ArrayList<>(), groups[i], colors[i % maxCol]); } for (Long date : activityData.navigableKeySet()) { diff --git a/Plan/common/src/test/java/com/djrapitops/plan/data/store/mutators/TPSMutatorTest.java b/Plan/common/src/test/java/com/djrapitops/plan/data/store/mutators/TPSMutatorTest.java index abbb66044..7116594f8 100644 --- a/Plan/common/src/test/java/com/djrapitops/plan/data/store/mutators/TPSMutatorTest.java +++ b/Plan/common/src/test/java/com/djrapitops/plan/data/store/mutators/TPSMutatorTest.java @@ -95,7 +95,7 @@ class TPSMutatorTest { long expected = TimeAmount.MONTH.toMillis(2L) - periodLength; TPSMutator tpsMutator = new TPSMutator(testData.stream() - .filter(tps -> (tps.getDate() - time) % (periodLength) == 0) + .filter(tps -> (tps.getDate() - time) % periodLength == 0) .collect(Collectors.toList())); assertFalse(tpsMutator.all().isEmpty()); assertNotEquals(testData, tpsMutator.all()); @@ -111,7 +111,7 @@ class TPSMutatorTest { long monthAgo = time - TimeAmount.MONTH.toMillis(1L); TPSMutator tpsMutator = new TPSMutator(testData.stream() - .filter(tps -> (tps.getDate() - time) % (periodLength) == 0) + .filter(tps -> (tps.getDate() - time) % periodLength == 0) .collect(Collectors.toList())) .filterDataBetween(monthAgo, time); @@ -131,7 +131,7 @@ class TPSMutatorTest { Collections.shuffle(randomOrder); long monthAgo = time - TimeAmount.MONTH.toMillis(1L); TPSMutator tpsMutator = new TPSMutator(randomOrder.stream() - .filter(tps -> (tps.getDate() - time) % (periodLength) == 0) + .filter(tps -> (tps.getDate() - time) % periodLength == 0) .collect(Collectors.toList())) .filterDataBetween(monthAgo, time); diff --git a/Plan/common/src/test/java/utilities/OptionalAssert.java b/Plan/common/src/test/java/utilities/OptionalAssert.java index caef5da06..ba1435f41 100644 --- a/Plan/common/src/test/java/utilities/OptionalAssert.java +++ b/Plan/common/src/test/java/utilities/OptionalAssert.java @@ -28,6 +28,10 @@ import static org.junit.jupiter.api.Assertions.assertTrue; */ public class OptionalAssert { + private OptionalAssert() { + /* Static method class */ + } + public static void equals(T expected, Optional result) { assertTrue(result.isPresent(), () -> "No result present, expected: " + expected); assertEquals(expected, result.get(), () -> "Wrong result, expected: " + expected + ", got: " + result.get()); diff --git a/Plan/common/src/test/java/utilities/RandomData.java b/Plan/common/src/test/java/utilities/RandomData.java index 05f11bb48..cf62b3a5d 100644 --- a/Plan/common/src/test/java/utilities/RandomData.java +++ b/Plan/common/src/test/java/utilities/RandomData.java @@ -33,6 +33,10 @@ import java.util.concurrent.ThreadLocalRandom; public class RandomData { + private RandomData() { + /* Static method class */ + } + private static final Random r = new Random(); public static int randomInt(int rangeStart, int rangeEnd) { diff --git a/Plan/common/src/test/java/utilities/TestConstants.java b/Plan/common/src/test/java/utilities/TestConstants.java index 7acb2654f..547fc7cdb 100644 --- a/Plan/common/src/test/java/utilities/TestConstants.java +++ b/Plan/common/src/test/java/utilities/TestConstants.java @@ -25,6 +25,10 @@ import java.util.UUID; */ public class TestConstants { + private TestConstants() { + /* Static variable class */ + } + public static final UUID SERVER_UUID = UUID.fromString("e4ec2edd-e0ed-3c58-a87d-8a9021899479"); public static final UUID SERVER_TWO_UUID = UUID.fromString("c4ec2edd-e0ed-3c58-a87d-8a9024791899"); public static final UUID PLAYER_ONE_UUID = UUID.fromString("45b0dfdb-f71d-4cf3-8c21-27c9d4c651db"); diff --git a/Plan/common/src/test/java/utilities/TestData.java b/Plan/common/src/test/java/utilities/TestData.java index 03786cc5e..7ffef8d8e 100644 --- a/Plan/common/src/test/java/utilities/TestData.java +++ b/Plan/common/src/test/java/utilities/TestData.java @@ -41,6 +41,10 @@ import java.util.logging.Logger; */ public class TestData { + private TestData() { + /* Utility class */ + } + private static UUID playerUUID = TestConstants.PLAYER_ONE_UUID; private static UUID player2UUID = TestConstants.PLAYER_TWO_UUID; private static UUID serverUUID = TestConstants.SERVER_UUID; diff --git a/Plan/common/src/test/java/utilities/TestDatabaseCreator.java b/Plan/common/src/test/java/utilities/TestDatabaseCreator.java index caa242659..4165a735c 100644 --- a/Plan/common/src/test/java/utilities/TestDatabaseCreator.java +++ b/Plan/common/src/test/java/utilities/TestDatabaseCreator.java @@ -49,9 +49,6 @@ public class TestDatabaseCreator { boolean oldDB = testDB.exists(); -// db = new SQLiteDB(testDB, Locale::new); -// db.init(); - r = new Random(); if (oldDB) { diff --git a/Plan/config/checkstyle/checkstyle.xml b/Plan/config/checkstyle/checkstyle.xml index 356e43fab..b4be762da 100644 --- a/Plan/config/checkstyle/checkstyle.xml +++ b/Plan/config/checkstyle/checkstyle.xml @@ -2,7 +2,6 @@ - @@ -10,12 +9,79 @@ + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +