From b95d7ca705819698677fecc6620b5c45bb098388 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sun, 27 Sep 2015 14:50:44 +0200 Subject: [PATCH] * Fixed some problems with new avatar handling. --- Mage.Client/serverlist.txt | 1 - .../mage/client/dialog/PreferencesDialog.java | 6 +++--- .../java/mage/client/game/PlayerPanelExt.java | 10 +++++----- Mage.Common/src/mage/constants/Constants.java | 4 ++++ Mage.Common/src/mage/utils/MageVersion.java | 2 +- .../src/main/java/mage/server/Session.java | 15 ++++++--------- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Mage.Client/serverlist.txt b/Mage.Client/serverlist.txt index eb5c37cbcb..db223b403f 100644 --- a/Mage.Client/serverlist.txt +++ b/Mage.Client/serverlist.txt @@ -2,6 +2,5 @@ XMage.de 1 (Europe/Germany) fast :xmage.de:17171 woogerworks (North America/USA) :xmage.woogerworks.info:17171 XMage.info 1 (Europe/France) new network code -> see forum :176.31.186.181:17171 XMage BR (South America/Brazil) :ec2-54-233-67-0.sa-east-1.compute.amazonaws.com:17171 -IceMage (Europe/Netherlands) :ring0.cc:17171 Seedds Server (Asia) :115.29.203.80:17171 localhost -> connect to your local server (must be started):localhost:17171 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 dde646aff4..c8f314e4a8 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/PreferencesDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/PreferencesDialog.java @@ -61,6 +61,9 @@ import mage.client.MageFrame; import mage.client.util.Config; import mage.client.util.ImageHelper; import mage.client.util.gui.BufferedImageBuilder; +import static mage.constants.Constants.DEFAULT_AVATAR_ID; +import static mage.constants.Constants.MAX_AVATAR_ID; +import static mage.constants.Constants.MIN_AVATAR_ID; import mage.players.net.UserData; import mage.players.net.UserGroup; import mage.players.net.UserSkipPrioritySteps; @@ -262,9 +265,6 @@ public class PreferencesDialog extends javax.swing.JDialog { public static String PHASE_ON = "on"; public static String PHASE_OFF = "off"; - public static final int MIN_AVATAR_ID = 10; - public static final int MAX_AVATAR_ID = 32; - public static final int DEFAULT_AVATAR_ID = 10; private static final Map panels = new HashMap<>(); private static final Border GREEN_BORDER = BorderFactory.createLineBorder(Color.GREEN, 3); diff --git a/Mage.Client/src/main/java/mage/client/game/PlayerPanelExt.java b/Mage.Client/src/main/java/mage/client/game/PlayerPanelExt.java index 1fd4c05df9..ff35040971 100644 --- a/Mage.Client/src/main/java/mage/client/game/PlayerPanelExt.java +++ b/Mage.Client/src/main/java/mage/client/game/PlayerPanelExt.java @@ -63,15 +63,15 @@ import mage.client.components.HoverButton; import mage.client.components.MageRoundPane; import mage.client.components.ext.dlg.DialogManager; import mage.client.dialog.PreferencesDialog; -import static mage.client.dialog.PreferencesDialog.DEFAULT_AVATAR_ID; -import static mage.client.dialog.PreferencesDialog.MAX_AVATAR_ID; -import static mage.client.dialog.PreferencesDialog.MIN_AVATAR_ID; import mage.client.util.CardsViewUtil; import mage.client.util.Command; import mage.client.util.ImageHelper; import mage.client.util.gui.BufferedImageBuilder; import mage.client.util.gui.countryBox.CountryUtil; import mage.components.ImagePanel; +import static mage.constants.Constants.DEFAULT_AVATAR_ID; +import static mage.constants.Constants.MAX_AVATAR_ID; +import static mage.constants.Constants.MIN_AVATAR_ID; import mage.constants.ManaType; import mage.remote.Session; import mage.utils.timer.PriorityTimer; @@ -241,8 +241,8 @@ public class PlayerPanelExt extends javax.swing.JPanel { if (!MageFrame.isLite()) { int id = player.getUserData().getAvatarId(); - if (id <= 0 || !(id >= 1000) || (id <= MIN_AVATAR_ID && id > MAX_AVATAR_ID)) { - id = PreferencesDialog.DEFAULT_AVATAR_ID; + if (!(id >= 1000) && (id <= 0 || (id <= MIN_AVATAR_ID && id > MAX_AVATAR_ID))) { + id = DEFAULT_AVATAR_ID; } if (id != avatarId) { avatarId = id; diff --git a/Mage.Common/src/mage/constants/Constants.java b/Mage.Common/src/mage/constants/Constants.java index 965346f281..fd8bf95052 100644 --- a/Mage.Common/src/mage/constants/Constants.java +++ b/Mage.Common/src/mage/constants/Constants.java @@ -67,6 +67,10 @@ public final class Constants { public static final double SCALE_FACTOR = 0.5; + public static final int MIN_AVATAR_ID = 10; + public static final int MAX_AVATAR_ID = 32; + public static final int DEFAULT_AVATAR_ID = 10; + /** * Time each player has during the game to play using his\her priority. */ diff --git a/Mage.Common/src/mage/utils/MageVersion.java b/Mage.Common/src/mage/utils/MageVersion.java index e2c6830fca..c28ce7ebc7 100644 --- a/Mage.Common/src/mage/utils/MageVersion.java +++ b/Mage.Common/src/mage/utils/MageVersion.java @@ -41,7 +41,7 @@ public class MageVersion implements Serializable, Comparable { public final static int MAGE_VERSION_MAJOR = 1; public final static int MAGE_VERSION_MINOR = 4; public final static int MAGE_VERSION_PATCH = 4; - public final static String MAGE_VERSION_MINOR_PATCH = "v6"; + public final static String MAGE_VERSION_MINOR_PATCH = "v7"; public final static String MAGE_VERSION_INFO = ""; private final int major; diff --git a/Mage.Server/src/main/java/mage/server/Session.java b/Mage.Server/src/main/java/mage/server/Session.java index ad5c8c0a91..16b1da7e51 100644 --- a/Mage.Server/src/main/java/mage/server/Session.java +++ b/Mage.Server/src/main/java/mage/server/Session.java @@ -36,6 +36,7 @@ import java.util.concurrent.locks.ReentrantLock; import java.util.regex.Matcher; import java.util.regex.Pattern; import mage.MageException; +import mage.constants.Constants; import mage.interfaces.callback.ClientCallback; import mage.players.net.UserData; import mage.players.net.UserGroup; @@ -157,6 +158,10 @@ public class Session { } else { user.getUserData().update(userData); } + if (user.getUserData().getAvatarId() < Constants.MIN_AVATAR_ID + || user.getUserData().getAvatarId() > Constants.MAX_AVATAR_ID) { + user.getUserData().setAvatarId(Constants.DEFAULT_AVATAR_ID); + } if (user.getUserData().getAvatarId() == 11) { user.getUserData().setAvatarId(updateAvatar(user.getName())); } @@ -169,24 +174,16 @@ public class Session { //TODO: move to separate class //TODO: add for checking for private key switch (userName) { - case "nantuko": - return 1000; case "North": return 1006; case "BetaSteward": return 1008; - case "loki": - return 1012; - case "Ayrat": - return 1018; case "Bandit": return 1020; case "fireshoes": return 1021; - case "Wehk": - return 66; } - return 51; + return 11; } public String getId() {