mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-12-18 14:47:47 +01:00
Checkstyle: Add 'WhitespaceAfter' check, fix some violations
This commit is contained in:
parent
e2e2c6bb79
commit
58e04556ee
@ -6,7 +6,7 @@
|
|||||||
<module name="Checker">
|
<module name="Checker">
|
||||||
<property name="charset" value="UTF-8"/>
|
<property name="charset" value="UTF-8"/>
|
||||||
<property name="severity" value="warning"/>
|
<property name="severity" value="warning"/>
|
||||||
<property name="fileExtensions" value="java, properties, xml"/>
|
<property name="fileExtensions" value="java"/>
|
||||||
|
|
||||||
<module name="SuppressWarningsFilter" />
|
<module name="SuppressWarningsFilter" />
|
||||||
|
|
||||||
@ -32,6 +32,7 @@
|
|||||||
<property name="format" value="TODO(?! #\d+:)|FIXME"/>
|
<property name="format" value="TODO(?! #\d+:)|FIXME"/>
|
||||||
</module>
|
</module>
|
||||||
<module name="GenericWhitespace"/>
|
<module name="GenericWhitespace"/>
|
||||||
|
<module name="WhitespaceAfter"/>
|
||||||
<module name="AvoidStarImport"/>
|
<module name="AvoidStarImport"/>
|
||||||
<module name="RedundantImport"/>
|
<module name="RedundantImport"/>
|
||||||
<module name="UnusedImports"/>
|
<module name="UnusedImports"/>
|
||||||
|
@ -198,7 +198,7 @@ public class AuthMe extends JavaPlugin {
|
|||||||
ConsoleLogger.setLogFile(new File(getDataFolder(), LOG_FILENAME));
|
ConsoleLogger.setLogFile(new File(getDataFolder(), LOG_FILENAME));
|
||||||
|
|
||||||
// Check java version
|
// 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!");
|
throw new IllegalStateException("You need Java 1.8 or above to run this plugin!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ public class ShowEmailCommand extends PlayerCommand {
|
|||||||
public void runCommand(Player player, List<String> arguments) {
|
public void runCommand(Player player, List<String> arguments) {
|
||||||
PlayerAuth auth = playerCache.getAuth(player.getName());
|
PlayerAuth auth = playerCache.getAuth(player.getName());
|
||||||
if (auth != null && !Utils.isEmailEmpty(auth.getEmail())) {
|
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()));
|
commonService.send(player, MessageKey.EMAIL_SHOW, emailMask(auth.getEmail()));
|
||||||
} else {
|
} else {
|
||||||
commonService.send(player, MessageKey.EMAIL_SHOW, auth.getEmail());
|
commonService.send(player, MessageKey.EMAIL_SHOW, auth.getEmail());
|
||||||
|
@ -48,7 +48,7 @@ public class QuickCommandsProtectionManager implements SettingsDependent, HasCle
|
|||||||
* @param player the player to process
|
* @param player the player to process
|
||||||
*/
|
*/
|
||||||
public void processJoin(Player player) {
|
public void processJoin(Player player) {
|
||||||
if(shouldSavePlayer(player)) {
|
if (shouldSavePlayer(player)) {
|
||||||
setJoin(player.getName());
|
setJoin(player.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -104,7 +104,7 @@ public class TempbanManager implements SettingsDependent, HasCleanup {
|
|||||||
expires.setTime(newTime);
|
expires.setTime(newTime);
|
||||||
|
|
||||||
bukkitService.scheduleSyncDelayedTask(() -> {
|
bukkitService.scheduleSyncDelayedTask(() -> {
|
||||||
if(customCommand.isEmpty()) {
|
if (customCommand.isEmpty()) {
|
||||||
bukkitService.banIp(ip, reason, expires, "AuthMe");
|
bukkitService.banIp(ip, reason, expires, "AuthMe");
|
||||||
player.kickPlayer(reason);
|
player.kickPlayer(reason);
|
||||||
} else {
|
} else {
|
||||||
|
@ -48,7 +48,7 @@ public class Log4JFilter extends AbstractFilter {
|
|||||||
@Override
|
@Override
|
||||||
public Result filter(LogEvent event) {
|
public Result filter(LogEvent event) {
|
||||||
Message candidate = null;
|
Message candidate = null;
|
||||||
if(event != null) {
|
if (event != null) {
|
||||||
candidate = event.getMessage();
|
candidate = event.getMessage();
|
||||||
}
|
}
|
||||||
return validateMessage(candidate);
|
return validateMessage(candidate);
|
||||||
@ -67,7 +67,7 @@ public class Log4JFilter extends AbstractFilter {
|
|||||||
@Override
|
@Override
|
||||||
public Result filter(Logger logger, Level level, Marker marker, Object msg, Throwable t) {
|
public Result filter(Logger logger, Level level, Marker marker, Object msg, Throwable t) {
|
||||||
String candidate = null;
|
String candidate = null;
|
||||||
if(msg != null) {
|
if (msg != null) {
|
||||||
candidate = msg.toString();
|
candidate = msg.toString();
|
||||||
}
|
}
|
||||||
return validateMessage(candidate);
|
return validateMessage(candidate);
|
||||||
|
@ -321,7 +321,7 @@ public class PermissionsManager implements Reloadable {
|
|||||||
* @param groupName The group name.
|
* @param groupName The group name.
|
||||||
*
|
*
|
||||||
* @return True if the player is in the specified group, false otherwise.
|
* @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) {
|
public boolean isInGroup(OfflinePlayer player, String groupName) {
|
||||||
return isEnabled() && handler.isInGroup(player, groupName);
|
return isEnabled() && handler.isInGroup(player, groupName);
|
||||||
@ -334,7 +334,7 @@ public class PermissionsManager implements Reloadable {
|
|||||||
* @param groupName The name of the group.
|
* @param groupName The name of the group.
|
||||||
*
|
*
|
||||||
* @return True if succeed, false otherwise.
|
* @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) {
|
public boolean addGroup(OfflinePlayer player, String groupName) {
|
||||||
if (!isEnabled() || StringUtils.isEmpty(groupName)) {
|
if (!isEnabled() || StringUtils.isEmpty(groupName)) {
|
||||||
@ -350,7 +350,7 @@ public class PermissionsManager implements Reloadable {
|
|||||||
* @param groupNames The name of the groups to add.
|
* @param groupNames The name of the groups to add.
|
||||||
*
|
*
|
||||||
* @return True if at least one group was added, false otherwise.
|
* @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) {
|
public boolean addGroups(OfflinePlayer player, Collection<String> groupNames) {
|
||||||
// If no permissions system is used, return false
|
// If no permissions system is used, return false
|
||||||
@ -377,7 +377,7 @@ public class PermissionsManager implements Reloadable {
|
|||||||
* @param groupName The name of the group.
|
* @param groupName The name of the group.
|
||||||
*
|
*
|
||||||
* @return True if succeed, false otherwise.
|
* @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) {
|
public boolean removeGroup(OfflinePlayer player, String groupName) {
|
||||||
return isEnabled() && handler.removeFromGroup(player, 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.
|
* @param groupNames The name of the groups to remove.
|
||||||
*
|
*
|
||||||
* @return True if at least one group was removed, false otherwise.
|
* @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) {
|
public boolean removeGroups(OfflinePlayer player, Collection<String> groupNames) {
|
||||||
// If no permissions system is used, return false
|
// If no permissions system is used, return false
|
||||||
@ -418,7 +418,7 @@ public class PermissionsManager implements Reloadable {
|
|||||||
* @param groupName The name of the group.
|
* @param groupName The name of the group.
|
||||||
*
|
*
|
||||||
* @return True if succeed, false otherwise.
|
* @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) {
|
public boolean setGroup(OfflinePlayer player, String groupName) {
|
||||||
return isEnabled() && handler.setGroup(player, 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.
|
* @param player The player to remove all groups from.
|
||||||
*
|
*
|
||||||
* @return True if succeed, false otherwise.
|
* @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) {
|
public boolean removeAllGroups(OfflinePlayer player) {
|
||||||
// If no permissions system is used, return false
|
// If no permissions system is used, return false
|
||||||
|
@ -157,16 +157,16 @@ public class ValidationService implements Reloadable {
|
|||||||
|
|
||||||
String ip = PlayerUtils.getPlayerIp(player);
|
String ip = PlayerUtils.getPlayerIp(player);
|
||||||
String domain = player.getAddress().getHostName();
|
String domain = player.getAddress().getHostName();
|
||||||
for(String restriction : restrictions) {
|
for (String restriction : restrictions) {
|
||||||
if(restriction.startsWith("regex:")) {
|
if (restriction.startsWith("regex:")) {
|
||||||
restriction = restriction.replace("regex:", "");
|
restriction = restriction.replace("regex:", "");
|
||||||
} else {
|
} else {
|
||||||
restriction = restriction.replaceAll("\\*","(.*)");
|
restriction = restriction.replace("*", "(.*)");
|
||||||
}
|
}
|
||||||
if(ip.matches(restriction)) {
|
if (ip.matches(restriction)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if(domain.matches(restriction)) {
|
if (domain.matches(restriction)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,8 @@ public class BungeeReceiver implements PluginMessageListener, SettingsDependent
|
|||||||
try {
|
try {
|
||||||
argument = in.readUTF();
|
argument = in.readUTF();
|
||||||
} catch (IllegalStateException e) {
|
} 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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,7 +188,7 @@ public class SettingsMigrationService extends PlainMigrationService {
|
|||||||
*/
|
*/
|
||||||
private static boolean migratePoolSizeSetting(PropertyResource resource) {
|
private static boolean migratePoolSizeSetting(PropertyResource resource) {
|
||||||
Integer oldValue = resource.getInt("DataSource.poolSize");
|
Integer oldValue = resource.getInt("DataSource.poolSize");
|
||||||
if(oldValue == null || oldValue > 0) {
|
if (oldValue == null || oldValue > 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
resource.setValue("DataSource.poolSize", 10);
|
resource.setValue("DataSource.poolSize", 10);
|
||||||
|
@ -73,7 +73,7 @@ class PurgeTask extends BukkitRunnable {
|
|||||||
|
|
||||||
OfflinePlayer offlinePlayer = offlinePlayers[nextPosition];
|
OfflinePlayer offlinePlayer = offlinePlayers[nextPosition];
|
||||||
if (offlinePlayer.getName() != null && toPurge.remove(offlinePlayer.getName().toLowerCase())) {
|
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!");
|
ConsoleLogger.warning("Unable to check if the user " + offlinePlayer.getName() + " can be purged!");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user