diff --git a/.checkstyle.xml b/.checkstyle.xml index d12ab0d40..eac59ec94 100644 --- a/.checkstyle.xml +++ b/.checkstyle.xml @@ -6,7 +6,7 @@ - + @@ -32,6 +32,7 @@ + diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 6a2b3583c..b206fed7a 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -198,7 +198,7 @@ public class AuthMe extends JavaPlugin { ConsoleLogger.setLogFile(new File(getDataFolder(), LOG_FILENAME)); // Check java version - if(!SystemUtils.isJavaVersionAtLeast(1.8f)) { + if (!SystemUtils.isJavaVersionAtLeast(1.8f)) { throw new IllegalStateException("You need Java 1.8 or above to run this plugin!"); } diff --git a/src/main/java/fr/xephi/authme/command/executable/email/ShowEmailCommand.java b/src/main/java/fr/xephi/authme/command/executable/email/ShowEmailCommand.java index f09321e6a..9e2049875 100644 --- a/src/main/java/fr/xephi/authme/command/executable/email/ShowEmailCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/email/ShowEmailCommand.java @@ -27,7 +27,7 @@ public class ShowEmailCommand extends PlayerCommand { public void runCommand(Player player, List arguments) { PlayerAuth auth = playerCache.getAuth(player.getName()); if (auth != null && !Utils.isEmailEmpty(auth.getEmail())) { - if(commonService.getProperty(SecuritySettings.USE_EMAIL_MASKING)){ + if (commonService.getProperty(SecuritySettings.USE_EMAIL_MASKING)){ commonService.send(player, MessageKey.EMAIL_SHOW, emailMask(auth.getEmail())); } else { commonService.send(player, MessageKey.EMAIL_SHOW, auth.getEmail()); diff --git a/src/main/java/fr/xephi/authme/data/QuickCommandsProtectionManager.java b/src/main/java/fr/xephi/authme/data/QuickCommandsProtectionManager.java index 335944c82..7414e21c8 100644 --- a/src/main/java/fr/xephi/authme/data/QuickCommandsProtectionManager.java +++ b/src/main/java/fr/xephi/authme/data/QuickCommandsProtectionManager.java @@ -48,7 +48,7 @@ public class QuickCommandsProtectionManager implements SettingsDependent, HasCle * @param player the player to process */ public void processJoin(Player player) { - if(shouldSavePlayer(player)) { + if (shouldSavePlayer(player)) { setJoin(player.getName()); } } diff --git a/src/main/java/fr/xephi/authme/data/TempbanManager.java b/src/main/java/fr/xephi/authme/data/TempbanManager.java index e6b685aca..fd2a0a3ed 100644 --- a/src/main/java/fr/xephi/authme/data/TempbanManager.java +++ b/src/main/java/fr/xephi/authme/data/TempbanManager.java @@ -104,7 +104,7 @@ public class TempbanManager implements SettingsDependent, HasCleanup { expires.setTime(newTime); bukkitService.scheduleSyncDelayedTask(() -> { - if(customCommand.isEmpty()) { + if (customCommand.isEmpty()) { bukkitService.banIp(ip, reason, expires, "AuthMe"); player.kickPlayer(reason); } else { diff --git a/src/main/java/fr/xephi/authme/output/Log4JFilter.java b/src/main/java/fr/xephi/authme/output/Log4JFilter.java index 1d044e184..1ebf5141f 100644 --- a/src/main/java/fr/xephi/authme/output/Log4JFilter.java +++ b/src/main/java/fr/xephi/authme/output/Log4JFilter.java @@ -48,7 +48,7 @@ public class Log4JFilter extends AbstractFilter { @Override public Result filter(LogEvent event) { Message candidate = null; - if(event != null) { + if (event != null) { candidate = event.getMessage(); } return validateMessage(candidate); @@ -67,7 +67,7 @@ public class Log4JFilter extends AbstractFilter { @Override public Result filter(Logger logger, Level level, Marker marker, Object msg, Throwable t) { String candidate = null; - if(msg != null) { + if (msg != null) { candidate = msg.toString(); } return validateMessage(candidate); diff --git a/src/main/java/fr/xephi/authme/permission/PermissionsManager.java b/src/main/java/fr/xephi/authme/permission/PermissionsManager.java index ec1fff9bb..61cd31f9b 100644 --- a/src/main/java/fr/xephi/authme/permission/PermissionsManager.java +++ b/src/main/java/fr/xephi/authme/permission/PermissionsManager.java @@ -321,7 +321,7 @@ public class PermissionsManager implements Reloadable { * @param groupName The group name. * * @return True if the player is in the specified group, false otherwise. - * False is also returned if groups aren't supported by the used permissions system. + * False is also returned if groups aren't supported by the used permissions system. */ public boolean isInGroup(OfflinePlayer player, String groupName) { return isEnabled() && handler.isInGroup(player, groupName); @@ -334,7 +334,7 @@ public class PermissionsManager implements Reloadable { * @param groupName The name of the group. * * @return True if succeed, false otherwise. - * False is also returned if this feature isn't supported for the current permissions system. + * False is also returned if this feature isn't supported for the current permissions system. */ public boolean addGroup(OfflinePlayer player, String groupName) { if (!isEnabled() || StringUtils.isEmpty(groupName)) { @@ -350,7 +350,7 @@ public class PermissionsManager implements Reloadable { * @param groupNames The name of the groups to add. * * @return True if at least one group was added, false otherwise. - * False is also returned if this feature isn't supported for the current permissions system. + * False is also returned if this feature isn't supported for the current permissions system. */ public boolean addGroups(OfflinePlayer player, Collection groupNames) { // If no permissions system is used, return false @@ -377,7 +377,7 @@ public class PermissionsManager implements Reloadable { * @param groupName The name of the group. * * @return True if succeed, false otherwise. - * False is also returned if this feature isn't supported for the current permissions system. + * False is also returned if this feature isn't supported for the current permissions system. */ public boolean removeGroup(OfflinePlayer player, String groupName) { return isEnabled() && handler.removeFromGroup(player, groupName); @@ -390,7 +390,7 @@ public class PermissionsManager implements Reloadable { * @param groupNames The name of the groups to remove. * * @return True if at least one group was removed, false otherwise. - * False is also returned if this feature isn't supported for the current permissions system. + * False is also returned if this feature isn't supported for the current permissions system. */ public boolean removeGroups(OfflinePlayer player, Collection groupNames) { // If no permissions system is used, return false @@ -418,7 +418,7 @@ public class PermissionsManager implements Reloadable { * @param groupName The name of the group. * * @return True if succeed, false otherwise. - * False is also returned if this feature isn't supported for the current permissions system. + * False is also returned if this feature isn't supported for the current permissions system. */ public boolean setGroup(OfflinePlayer player, String groupName) { return isEnabled() && handler.setGroup(player, groupName); @@ -432,7 +432,7 @@ public class PermissionsManager implements Reloadable { * @param player The player to remove all groups from. * * @return True if succeed, false otherwise. - * False will also be returned if this feature isn't supported for the used permissions system. + * False will also be returned if this feature isn't supported for the used permissions system. */ public boolean removeAllGroups(OfflinePlayer player) { // If no permissions system is used, return false diff --git a/src/main/java/fr/xephi/authme/service/ValidationService.java b/src/main/java/fr/xephi/authme/service/ValidationService.java index 840b9c4c9..2e52192fe 100644 --- a/src/main/java/fr/xephi/authme/service/ValidationService.java +++ b/src/main/java/fr/xephi/authme/service/ValidationService.java @@ -157,16 +157,16 @@ public class ValidationService implements Reloadable { String ip = PlayerUtils.getPlayerIp(player); String domain = player.getAddress().getHostName(); - for(String restriction : restrictions) { - if(restriction.startsWith("regex:")) { + for (String restriction : restrictions) { + if (restriction.startsWith("regex:")) { restriction = restriction.replace("regex:", ""); } else { - restriction = restriction.replaceAll("\\*","(.*)"); + restriction = restriction.replace("*", "(.*)"); } - if(ip.matches(restriction)) { + if (ip.matches(restriction)) { return true; } - if(domain.matches(restriction)) { + if (domain.matches(restriction)) { return true; } } diff --git a/src/main/java/fr/xephi/authme/service/bungeecord/BungeeReceiver.java b/src/main/java/fr/xephi/authme/service/bungeecord/BungeeReceiver.java index c0469c9be..c2b36588f 100644 --- a/src/main/java/fr/xephi/authme/service/bungeecord/BungeeReceiver.java +++ b/src/main/java/fr/xephi/authme/service/bungeecord/BungeeReceiver.java @@ -99,7 +99,8 @@ public class BungeeReceiver implements PluginMessageListener, SettingsDependent try { argument = in.readUTF(); } catch (IllegalStateException e) { - ConsoleLogger.warning("Received invalid plugin message of type " + type.get().name() + ": argument is missing!"); + ConsoleLogger.warning("Received invalid plugin message of type " + type.get().name() + + ": argument is missing!"); return; } diff --git a/src/main/java/fr/xephi/authme/settings/SettingsMigrationService.java b/src/main/java/fr/xephi/authme/settings/SettingsMigrationService.java index d95f73ce5..cc671656b 100644 --- a/src/main/java/fr/xephi/authme/settings/SettingsMigrationService.java +++ b/src/main/java/fr/xephi/authme/settings/SettingsMigrationService.java @@ -188,7 +188,7 @@ public class SettingsMigrationService extends PlainMigrationService { */ private static boolean migratePoolSizeSetting(PropertyResource resource) { Integer oldValue = resource.getInt("DataSource.poolSize"); - if(oldValue == null || oldValue > 0) { + if (oldValue == null || oldValue > 0) { return false; } resource.setValue("DataSource.poolSize", 10); diff --git a/src/main/java/fr/xephi/authme/task/purge/PurgeTask.java b/src/main/java/fr/xephi/authme/task/purge/PurgeTask.java index 2a381ceba..06bf06f50 100644 --- a/src/main/java/fr/xephi/authme/task/purge/PurgeTask.java +++ b/src/main/java/fr/xephi/authme/task/purge/PurgeTask.java @@ -73,7 +73,7 @@ class PurgeTask extends BukkitRunnable { OfflinePlayer offlinePlayer = offlinePlayers[nextPosition]; if (offlinePlayer.getName() != null && toPurge.remove(offlinePlayer.getName().toLowerCase())) { - if(!permissionsManager.loadUserData(offlinePlayer)) { + if (!permissionsManager.loadUserData(offlinePlayer)) { ConsoleLogger.warning("Unable to check if the user " + offlinePlayer.getName() + " can be purged!"); continue; }