Fix various code issues as detected by Sonar

Mostly minor changes:
- Add deprecated javadoc tag on deprecated members
- Reduce duplication (FlatFile, BackupService, ...)
- Make methods static
- Reduce size of anonymous classes
- Replace name with displayName in PermissionsSystemType (avoids confusing with Enum name())
- Tabs to spaces
- Merge if statements

Code from third-party sources (BCryptService, BinTools, PHPBB) not modified.
This commit is contained in:
ljacqu
2016-11-22 18:19:46 +01:00
parent 8685e50988
commit 7d65d2a7c4
32 changed files with 172 additions and 197 deletions
@@ -78,12 +78,12 @@ public class PermissionsManager implements Reloadable {
if (handler != null) {
// Show a success message and return
this.handler = handler;
ConsoleLogger.info("Hooked into " + type.getName() + "!");
ConsoleLogger.info("Hooked into " + type.getDisplayName() + "!");
return;
}
} catch (Exception ex) {
// An error occurred, show a warning message
ConsoleLogger.logException("Error while hooking into " + type.getName(), ex);
ConsoleLogger.logException("Error while hooking into " + type.getDisplayName(), ex);
}
}
@@ -101,7 +101,7 @@ public class PermissionsManager implements Reloadable {
// Make sure the plugin is enabled before hooking
if (!plugin.isEnabled()) {
ConsoleLogger.info("Not hooking into " + type.getName() + " because it's disabled!");
ConsoleLogger.info("Not hooking into " + type.getDisplayName() + " because it's disabled!");
return null;
}
@@ -414,7 +414,7 @@ public class PermissionsManager implements Reloadable {
*/
public boolean setGroups(Player player, List<String> groupNames) {
// If no permissions system is used or if there's no group supplied, return false
if (!isEnabled() || groupNames.size() <= 0)
if (!isEnabled() || groupNames.isEmpty())
return false;
// Set the main group