Setup unrestricted names into lowercase.

This commit is contained in:
DNx5 2015-12-01 02:14:28 +07:00
parent e387a801f7
commit 8a6ab3edb5
2 changed files with 10 additions and 4 deletions

View File

@ -184,7 +184,12 @@ public final class Settings extends YamlConfiguration {
getMySQLColumnRealName = configFile.getString("DataSource.mySQLRealName", "realname"); getMySQLColumnRealName = configFile.getString("DataSource.mySQLRealName", "realname");
getNonActivatedGroup = configFile.getInt("ExternalBoardOptions.nonActivedUserGroup", -1); getNonActivatedGroup = configFile.getInt("ExternalBoardOptions.nonActivedUserGroup", -1);
unRegisteredGroup = configFile.getString("GroupOptions.UnregisteredPlayerGroup", ""); unRegisteredGroup = configFile.getString("GroupOptions.UnregisteredPlayerGroup", "");
getUnrestrictedName = configFile.getStringList("settings.unrestrictions.UnrestrictedName");
getUnrestrictedName = new ArrayList<>();
for (String name : configFile.getStringList("settings.unrestrictions.UnrestrictedName")) {
getUnrestrictedName.add(name.toLowerCase());
}
getRegisteredGroup = configFile.getString("GroupOptions.RegisteredPlayerGroup", ""); getRegisteredGroup = configFile.getString("GroupOptions.RegisteredPlayerGroup", "");
getEnablePasswordVerifier = configFile.getBoolean("settings.restrictions.enablePasswordVerifier", true); getEnablePasswordVerifier = configFile.getBoolean("settings.restrictions.enablePasswordVerifier", true);
@ -689,7 +694,7 @@ public final class Settings extends YamlConfiguration {
/** /**
* Saves current configuration (plus defaults) to disk. * Saves current configuration (plus defaults) to disk.
* <p/> * <p>
* If defaults and configuration are empty, saves blank file. * If defaults and configuration are empty, saves blank file.
* *
* @return True if saved successfully * @return True if saved successfully

View File

@ -156,8 +156,9 @@ public final class Utils {
} }
public static boolean isUnrestricted(Player player) { public static boolean isUnrestricted(Player player) {
return Settings.isAllowRestrictedIp && !Settings.getUnrestrictedName.isEmpty() return Settings.isAllowRestrictedIp
&& (Settings.getUnrestrictedName.contains(player.getName())); && !Settings.getUnrestrictedName.isEmpty()
&& (Settings.getUnrestrictedName.contains(player.getName().toLowerCase()));
} }
/** /**