Fix wrong logic (my fault)

This commit is contained in:
Gabriele C 2016-05-20 22:02:26 +02:00
parent 6285a2137f
commit 6af65e6cd4
2 changed files with 2 additions and 2 deletions

View File

@ -362,7 +362,7 @@ public class AuthMePlayerListener implements Listener {
String nickRegEx = settings.getProperty(RestrictionSettings.ALLOWED_NICKNAME_CHARACTERS);
Pattern nickPattern = Pattern.compile(nickRegEx);
if (nickPattern.matcher(player.getName()).matches() || name.equalsIgnoreCase("Player")) {
if (name.equalsIgnoreCase("Player") || !nickPattern.matcher(player.getName()).matches()) {
event.setKickMessage(m.retrieveSingle(MessageKey.INVALID_NAME_CHARACTERS).replace("REG_EX", nickRegEx));
event.setResult(PlayerLoginEvent.Result.KICK_OTHER);
return;

View File

@ -61,7 +61,7 @@ public final class Settings {
getSessionTimeout = configFile.getInt("settings.sessions.timeout", 10);
getMaxNickLength = configFile.getInt("settings.restrictions.maxNicknameLength", 20);
getMinNickLength = configFile.getInt("settings.restrictions.minNicknameLength", 3);
getNickRegex = configFile.getString("settings.restrictions.allowedNicknameCharacters", "[a-zA-Z0-9_?]*");
getNickRegex = load(RestrictionSettings.ALLOWED_NICKNAME_CHARACTERS);
nickPattern = Pattern.compile(getNickRegex);
isAllowRestrictedIp = load(RestrictionSettings.ENABLE_RESTRICTED_USERS);
isRemoveSpeedEnabled = load(RestrictionSettings.REMOVE_SPEED);