Checkstyle: Add 'WhitespaceAfter' check, fix some violations

This commit is contained in:
ljacqu 2018-09-01 08:38:14 +02:00
parent e2e2c6bb79
commit 58e04556ee
11 changed files with 24 additions and 22 deletions

View File

@ -6,7 +6,7 @@
<module name="Checker">
<property name="charset" value="UTF-8"/>
<property name="severity" value="warning"/>
<property name="fileExtensions" value="java, properties, xml"/>
<property name="fileExtensions" value="java"/>
<module name="SuppressWarningsFilter" />
@ -32,6 +32,7 @@
<property name="format" value="TODO(?! #\d+:)|FIXME"/>
</module>
<module name="GenericWhitespace"/>
<module name="WhitespaceAfter"/>
<module name="AvoidStarImport"/>
<module name="RedundantImport"/>
<module name="UnusedImports"/>

View File

@ -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!");
}

View File

@ -27,7 +27,7 @@ public class ShowEmailCommand extends PlayerCommand {
public void runCommand(Player player, List<String> 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());

View File

@ -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());
}
}

View File

@ -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 {

View File

@ -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);

View File

@ -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<String> 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<String> 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

View File

@ -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;
}
}

View File

@ -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;
}

View File

@ -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);

View File

@ -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;
}