From e2453abbb5f991ba747211c0b383d49c9a355d14 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Tue, 29 Sep 2015 17:26:29 +0200 Subject: [PATCH] * Fixed a bug that some options in preferences were handled with the wrong state as long as never set manually. --- .../java/mage/client/dialog/PreferencesDialog.java | 1 + Mage.Server/src/main/java/mage/server/Session.java | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Mage.Client/src/main/java/mage/client/dialog/PreferencesDialog.java b/Mage.Client/src/main/java/mage/client/dialog/PreferencesDialog.java index c8f314e4a8..e84416bcdf 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/PreferencesDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/PreferencesDialog.java @@ -2565,6 +2565,7 @@ public class PreferencesDialog extends javax.swing.JDialog { private static void load(Preferences prefs, JCheckBox checkBox, String propName, String yesValue, String defaultValue) { String prop = prefs.get(propName, defaultValue); checkBox.setSelected(prop.equals(yesValue)); + updateCache(propName, prop); } private static void load(Preferences prefs, JTextField field, String propName, String defaultValue) { diff --git a/Mage.Server/src/main/java/mage/server/Session.java b/Mage.Server/src/main/java/mage/server/Session.java index 16b1da7e51..9a03b6e0e0 100644 --- a/Mage.Server/src/main/java/mage/server/Session.java +++ b/Mage.Server/src/main/java/mage/server/Session.java @@ -92,15 +92,15 @@ public class Session { return "User name Admin already in use"; } if (userName.length() > ConfigSettings.getInstance().getMaxUserNameLength()) { - return new StringBuilder("User name may not be longer than ").append(ConfigSettings.getInstance().getMaxUserNameLength()).append(" characters").toString(); + return "User name may not be longer than " + ConfigSettings.getInstance().getMaxUserNameLength() + " characters"; } if (userName.length() < ConfigSettings.getInstance().getMinUserNameLength()) { - return new StringBuilder("User name may not be shorter than ").append(ConfigSettings.getInstance().getMinUserNameLength()).append(" characters").toString(); + return "User name may not be shorter than " + ConfigSettings.getInstance().getMinUserNameLength() + " characters"; } Pattern p = Pattern.compile(ConfigSettings.getInstance().getUserNamePattern(), Pattern.CASE_INSENSITIVE); Matcher m = p.matcher(userName); if (m.find()) { - return new StringBuilder("User name '").append(userName).append("' includes not allowed characters: use a-z, A-Z and 0-9").toString(); + return "User name '" + userName + "' includes not allowed characters: use a-z, A-Z and 0-9"; } User user = UserManager.getInstance().createUser(userName, host); boolean reconnect = false; @@ -118,11 +118,11 @@ public class Session { SessionManager.getInstance().disconnect(user.getSessionId(), DisconnectReason.ConnectingOtherInstance); } } else { - return new StringBuilder("User name ").append(userName).append(" already in use (or your IP address changed)").toString(); + return "User name " + userName + " already in use (or your IP address changed)"; } } if (!UserManager.getInstance().connectToSession(sessionId, user.getId())) { - return new StringBuilder("Error connecting ").append(userName).toString(); + return "Error connecting " + userName; } this.userId = user.getId(); if (reconnect) { // must be connected to receive the message