From 571c6106a77be345ec8d9542b21e1d0c6f2b5806 Mon Sep 17 00:00:00 2001 From: ljacqu Date: Sun, 30 Jan 2022 10:32:49 +0100 Subject: [PATCH] Fix some Checkstyle issues - Remove unused imports - Fix issues relating to line length / whitespace - Update Checkstyle suppression in matcher classes with new check name --- .checkstyle.xml | 4 +++- src/main/java/fr/xephi/authme/datasource/MySQL.java | 3 ++- .../java/fr/xephi/authme/process/email/AsyncAddEmail.java | 3 ++- src/main/java/fr/xephi/authme/service/AntiBotService.java | 2 -- src/main/java/fr/xephi/authme/service/BukkitService.java | 2 -- src/main/java/fr/xephi/authme/service/GeoIpService.java | 4 ++-- .../fr/xephi/authme/settings/SettingsMigrationService.java | 3 ++- src/test/java/fr/xephi/authme/AuthMeMatchers.java | 3 ++- .../java/fr/xephi/authme/data/limbo/LimboPlayerMatchers.java | 3 ++- 9 files changed, 15 insertions(+), 12 deletions(-) diff --git a/.checkstyle.xml b/.checkstyle.xml index 593a1806f..dc14b095e 100644 --- a/.checkstyle.xml +++ b/.checkstyle.xml @@ -149,7 +149,9 @@ - + + + diff --git a/src/main/java/fr/xephi/authme/datasource/MySQL.java b/src/main/java/fr/xephi/authme/datasource/MySQL.java index 72f10b16d..e55a24fd7 100644 --- a/src/main/java/fr/xephi/authme/datasource/MySQL.java +++ b/src/main/java/fr/xephi/authme/datasource/MySQL.java @@ -105,7 +105,8 @@ public class MySQL extends AbstractSqlDataSource { Class.forName(this.className); } catch (ClassNotFoundException e) { this.className = DatabaseSettings.MYSQL_DRIVER_CLASS_NAME.getDefaultValue(); - logger.info("Driver class '" + this.className + "' not found! Falling back to the built-in MySQL driver (" + this.className + ")"); + logger.info("Driver class '" + this.className + "' not found! Falling back to the built-in MySQL driver (" + + this.className + ")"); } this.database = settings.getProperty(DatabaseSettings.MYSQL_DATABASE); this.tableName = settings.getProperty(DatabaseSettings.MYSQL_TABLE); diff --git a/src/main/java/fr/xephi/authme/process/email/AsyncAddEmail.java b/src/main/java/fr/xephi/authme/process/email/AsyncAddEmail.java index 16ad41811..63dd75408 100644 --- a/src/main/java/fr/xephi/authme/process/email/AsyncAddEmail.java +++ b/src/main/java/fr/xephi/authme/process/email/AsyncAddEmail.java @@ -43,7 +43,8 @@ public class AsyncAddEmail implements AsynchronousProcess { @Inject private BukkitService bukkitService; - AsyncAddEmail() { } + AsyncAddEmail() { + } /** * Handles the request to add the given email to the player's account. diff --git a/src/main/java/fr/xephi/authme/service/AntiBotService.java b/src/main/java/fr/xephi/authme/service/AntiBotService.java index 47d8b9007..fbc19e8ba 100644 --- a/src/main/java/fr/xephi/authme/service/AntiBotService.java +++ b/src/main/java/fr/xephi/authme/service/AntiBotService.java @@ -11,8 +11,6 @@ import fr.xephi.authme.util.AtomicIntervalCounter; import org.bukkit.scheduler.BukkitTask; import javax.inject.Inject; -import java.time.Instant; -import java.time.temporal.ChronoUnit; import java.util.concurrent.CopyOnWriteArrayList; import static fr.xephi.authme.service.BukkitService.TICKS_PER_MINUTE; diff --git a/src/main/java/fr/xephi/authme/service/BukkitService.java b/src/main/java/fr/xephi/authme/service/BukkitService.java index c5425b375..b1262678f 100644 --- a/src/main/java/fr/xephi/authme/service/BukkitService.java +++ b/src/main/java/fr/xephi/authme/service/BukkitService.java @@ -14,9 +14,7 @@ import org.bukkit.command.CommandSender; import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.entity.Player; import org.bukkit.event.Event; -import org.bukkit.plugin.Plugin; import org.bukkit.scheduler.BukkitRunnable; -import org.bukkit.scheduler.BukkitScheduler; import org.bukkit.scheduler.BukkitTask; import javax.inject.Inject; diff --git a/src/main/java/fr/xephi/authme/service/GeoIpService.java b/src/main/java/fr/xephi/authme/service/GeoIpService.java index 808ae98a9..d2e7324fe 100644 --- a/src/main/java/fr/xephi/authme/service/GeoIpService.java +++ b/src/main/java/fr/xephi/authme/service/GeoIpService.java @@ -304,12 +304,12 @@ public class GeoIpService { * * @param ip textual IP address to lookup * @return the wrapped Country model or {@link Optional#empty()} if - *
    + *
      *
    • Database reader isn't initialized
    • *
    • MaxMind has no record about this IP address
    • *
    • IP address is local
    • *
    • Textual representation is not a valid IP address
    • - *
    + *
*/ private Optional getCountry(String ip) { if (ip == null || ip.isEmpty() || !isDataAvailable()) { diff --git a/src/main/java/fr/xephi/authme/settings/SettingsMigrationService.java b/src/main/java/fr/xephi/authme/settings/SettingsMigrationService.java index ca8da5dad..a8b437d76 100644 --- a/src/main/java/fr/xephi/authme/settings/SettingsMigrationService.java +++ b/src/main/java/fr/xephi/authme/settings/SettingsMigrationService.java @@ -67,7 +67,8 @@ public class SettingsMigrationService extends PlainMigrationService { } String driverClass = reader.getString(DatabaseSettings.MYSQL_DRIVER_CLASS_NAME.getPath()); if ("com.mysql.jdbc.Driver".equals(driverClass) || "com.mysql.cj.jdbc.Driver".equals(driverClass)) { - configurationData.setValue(DatabaseSettings.MYSQL_DRIVER_CLASS_NAME, DatabaseSettings.MYSQL_DRIVER_CLASS_NAME.getDefaultValue()); + configurationData.setValue(DatabaseSettings.MYSQL_DRIVER_CLASS_NAME, + DatabaseSettings.MYSQL_DRIVER_CLASS_NAME.getDefaultValue()); changes = true; } diff --git a/src/test/java/fr/xephi/authme/AuthMeMatchers.java b/src/test/java/fr/xephi/authme/AuthMeMatchers.java index 653fb04c9..86fe4cb91 100644 --- a/src/test/java/fr/xephi/authme/AuthMeMatchers.java +++ b/src/test/java/fr/xephi/authme/AuthMeMatchers.java @@ -11,7 +11,8 @@ import java.util.Objects; /** * Custom matchers for AuthMe entities. */ -@SuppressWarnings("checkstyle:JavadocMethod") // Justification: Javadoc would be huge because of the many parameters +// Justification: Javadoc would be huge because of the many parameters +@SuppressWarnings("checkstyle:MissingJavadocMethod") public final class AuthMeMatchers { private AuthMeMatchers() { diff --git a/src/test/java/fr/xephi/authme/data/limbo/LimboPlayerMatchers.java b/src/test/java/fr/xephi/authme/data/limbo/LimboPlayerMatchers.java index 8a47a5812..e2bc6808f 100644 --- a/src/test/java/fr/xephi/authme/data/limbo/LimboPlayerMatchers.java +++ b/src/test/java/fr/xephi/authme/data/limbo/LimboPlayerMatchers.java @@ -17,7 +17,8 @@ import static org.hamcrest.collection.IsIterableContainingInOrder.contains; /** * Contains matchers for LimboPlayer. */ -@SuppressWarnings("checkstyle:JavadocMethod") // Justification: Javadoc would be huge because of the many parameters +// Justification: Javadoc would be huge because of the many parameters +@SuppressWarnings("checkstyle:MissingJavadocMethod") public final class LimboPlayerMatchers { private LimboPlayerMatchers() {