mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-08-08 05:23:12 +00:00
Cleanup code (#3067)
Co-Authored-By: md678685 <1917406+md678685@users.noreply.github.com> Basically cleans up a bunch of warnings that are easily suppressed.
This commit is contained in:
parent
6bbdbc89a6
commit
23f0f98af3
98 changed files with 986 additions and 1179 deletions
|
@ -187,7 +187,7 @@ public class Settings implements net.ess3.api.ISettings {
|
|||
return isCommandDisabled(cmd.getName());
|
||||
}
|
||||
|
||||
private Set<String> disabledCommands = new HashSet<String>();
|
||||
private Set<String> disabledCommands = new HashSet<>();
|
||||
|
||||
@Override
|
||||
public boolean isCommandDisabled(String label) {
|
||||
|
@ -195,7 +195,7 @@ public class Settings implements net.ess3.api.ISettings {
|
|||
}
|
||||
|
||||
private Set<String> getDisabledCommands() {
|
||||
Set<String> disCommands = new HashSet<String>();
|
||||
Set<String> disCommands = new HashSet<>();
|
||||
for (String c : config.getStringList("disabled-commands")) {
|
||||
disCommands.add(c.toLowerCase(Locale.ENGLISH));
|
||||
}
|
||||
|
@ -275,10 +275,10 @@ public class Settings implements net.ess3.api.ISettings {
|
|||
return BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
private Set<String> socialSpyCommands = new HashSet<String>();
|
||||
private Set<String> socialSpyCommands = new HashSet<>();
|
||||
|
||||
private Set<String> _getSocialSpyCommands() {
|
||||
Set<String> socialspyCommands = new HashSet<String>();
|
||||
Set<String> socialspyCommands = new HashSet<>();
|
||||
|
||||
if (config.isList("socialspy-commands")) {
|
||||
for (String c : config.getStringList("socialspy-commands")) {
|
||||
|
@ -301,10 +301,10 @@ public class Settings implements net.ess3.api.ISettings {
|
|||
return config.getBoolean("socialspy-listen-muted-players", true);
|
||||
}
|
||||
|
||||
private Set<String> muteCommands = new HashSet<String>();
|
||||
private Set<String> muteCommands = new HashSet<>();
|
||||
|
||||
private Set<String> _getMuteCommands() {
|
||||
Set<String> muteCommands = new HashSet<String>();
|
||||
Set<String> muteCommands = new HashSet<>();
|
||||
if (config.isList("mute-commands")) {
|
||||
for (String s : config.getStringList("mute-commands")) {
|
||||
muteCommands.add(s.toLowerCase(Locale.ENGLISH));
|
||||
|
@ -384,7 +384,7 @@ public class Settings implements net.ess3.api.ISettings {
|
|||
|
||||
try {
|
||||
return ChatColor.valueOf(colorName.toUpperCase(Locale.ENGLISH));
|
||||
} catch (IllegalArgumentException ex) {
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
}
|
||||
|
||||
return ChatColor.getByChar(colorName);
|
||||
|
@ -425,7 +425,7 @@ public class Settings implements net.ess3.api.ISettings {
|
|||
return config.getString("backup.command", null);
|
||||
}
|
||||
|
||||
private final Map<String, String> chatFormats = Collections.synchronizedMap(new HashMap<String, String>());
|
||||
private final Map<String, String> chatFormats = Collections.synchronizedMap(new HashMap<>());
|
||||
|
||||
@Override
|
||||
public String getChatFormat(String group) {
|
||||
|
@ -487,7 +487,7 @@ public class Settings implements net.ess3.api.ISettings {
|
|||
return values;
|
||||
}
|
||||
}
|
||||
Map<String, Object> defaultMap = new HashMap<String, Object>();
|
||||
Map<String, Object> defaultMap = new HashMap<>();
|
||||
if (config.getBoolean("sort-list-by-groups", false)) {
|
||||
defaultMap.put("ListByGroup", "ListByGroup");
|
||||
} else {
|
||||
|
@ -499,7 +499,7 @@ public class Settings implements net.ess3.api.ISettings {
|
|||
@Override
|
||||
public void reloadConfig() {
|
||||
config.load();
|
||||
noGodWorlds = new HashSet<String>(config.getStringList("no-god-in-worlds"));
|
||||
noGodWorlds = new HashSet<>(config.getStringList("no-god-in-worlds"));
|
||||
enabledSigns = _getEnabledSigns();
|
||||
teleportSafety = _isTeleportSafetyEnabled();
|
||||
forceDisableTeleportSafety = _isForceDisableTeleportSafety();
|
||||
|
@ -600,7 +600,7 @@ public class Settings implements net.ess3.api.ISettings {
|
|||
return epItemSpwn;
|
||||
}
|
||||
|
||||
private List<EssentialsSign> enabledSigns = new ArrayList<EssentialsSign>();
|
||||
private List<EssentialsSign> enabledSigns = new ArrayList<>();
|
||||
private boolean signsEnabled = false;
|
||||
|
||||
@Override
|
||||
|
@ -611,7 +611,7 @@ public class Settings implements net.ess3.api.ISettings {
|
|||
private List<EssentialsSign> _getEnabledSigns() {
|
||||
this.signsEnabled = false; // Ensure boolean resets on reload.
|
||||
|
||||
List<EssentialsSign> newSigns = new ArrayList<EssentialsSign>();
|
||||
List<EssentialsSign> newSigns = new ArrayList<>();
|
||||
|
||||
for (String signName : config.getStringList("enabledSigns")) {
|
||||
signName = signName.trim().toUpperCase(Locale.ENGLISH);
|
||||
|
@ -966,7 +966,7 @@ public class Settings implements net.ess3.api.ISettings {
|
|||
return config.getBoolean("death-messages", true);
|
||||
}
|
||||
|
||||
private Set<String> noGodWorlds = new HashSet<String>();
|
||||
private Set<String> noGodWorlds = new HashSet<>();
|
||||
|
||||
@Override
|
||||
public Set<String> getNoGodWorlds() {
|
||||
|
@ -1132,8 +1132,7 @@ public class Settings implements net.ess3.api.ISettings {
|
|||
|
||||
private long _getEconomyLagWarning() {
|
||||
// Default to 25ms
|
||||
final long value = (long) (config.getDouble("economy-lag-warning", 25.0) * 1000000);
|
||||
return value;
|
||||
return (long) (config.getDouble("economy-lag-warning", 25.0) * 1000000);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1146,8 +1145,7 @@ public class Settings implements net.ess3.api.ISettings {
|
|||
|
||||
private long _getPermissionsLagWarning() {
|
||||
// Default to 25ms
|
||||
final long value = (long) (config.getDouble("permissions-lag-warning", 25.0) * 1000000);
|
||||
return value;
|
||||
return (long) (config.getDouble("permissions-lag-warning", 25.0) * 1000000);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1345,7 +1343,7 @@ public class Settings implements net.ess3.api.ISettings {
|
|||
* >> Process cooldown value
|
||||
* ================================ */
|
||||
Object value = section.get(cmdEntry);
|
||||
if (!(value instanceof Number) && value instanceof String) {
|
||||
if (value instanceof String) {
|
||||
try {
|
||||
value = Double.parseDouble(value.toString());
|
||||
} catch (NumberFormatException ignored) {
|
||||
|
@ -1457,7 +1455,6 @@ public class Settings implements net.ess3.api.ISettings {
|
|||
newSigns.add(Signs.valueOf(signName).getSign());
|
||||
} catch (Exception ex) {
|
||||
logger.log(Level.SEVERE, tl("unknownItemInList", signName, "unprotected-sign-names"));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return newSigns;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue