From 129b6d1e82b243f3620657194c1910a01a5b9677 Mon Sep 17 00:00:00 2001 From: betasteward Date: Wed, 19 Aug 2015 11:05:33 -0400 Subject: [PATCH] cleanUp --- .../src/main/java/mage/client/MageFrame.java | 53 +- .../src/main/java/mage/client/cards/Card.java | 2 - .../main/java/mage/client/cards/Cards.java | 52 +- .../main/java/mage/client/chat/ChatPanel.java | 2 - .../components/ability/AbilityPicker.java | 1 - .../client/deckeditor/DeckEditorPanel.java | 1 - .../mage/client/dialog/ConnectDialog.java | 1 - .../mage/client/dialog/JoinTableDialog.java | 1 - .../mage/client/dialog/NewTableDialog.java | 1 - .../client/dialog/NewTournamentDialog.java | 1 - .../client/dialog/TableWaitingDialog.java | 1 - .../mage/client/dialog/UserRequestDialog.java | 1 - .../java/mage/client/game/AbilityPicker.java | 1 - .../java/mage/client/game/FeedbackPanel.java | 8 - .../java/mage/client/game/PlayerPanelExt.java | 1 - .../plugins/adapters/MageActionCallback.java | 1 - .../client/remote/CallbackClientImpl.java | 495 ------ .../mage/client/table/TablePlayerPanel.java | 1 - .../java/mage/client/table/TablesPanel.java | 105 -- .../client/table/TournamentPlayerPanel.java | 1 - .../mage/client/unusedFiles/PlayerPanel.java | 1 - .../client/util/DefaultActionCallback.java | 1 - .../mage/client/game/MultiConnectTest.java | 5 - .../src/mage/interfaces/MageClient.java | 46 - .../src/mage/interfaces/MageServer.java | 158 -- Mage.Common/src/mage/remote/Connection.java | 47 +- Mage.Common/src/mage/remote/Session.java | 49 - Mage.Common/src/mage/remote/SessionImpl.java | 1473 ----------------- Mage.Server/config/config.xml | 2 +- Mage.Server/pom.xml | 14 - .../main/java/mage/server/ChatManager.java | 4 - .../main/java/mage/server/ChatSession.java | 1 - .../src/main/java/mage/server/Session.java | 30 - .../main/java/mage/server/SessionManager.java | 20 - .../src/main/java/mage/server/User.java | 47 - .../main/java/mage/server/UserManager.java | 46 +- .../mage/server/game/GameSessionPlayer.java | 12 - .../mage/server/game/GameSessionWatcher.java | 1 - 38 files changed, 33 insertions(+), 2654 deletions(-) delete mode 100644 Mage.Client/src/main/java/mage/client/remote/CallbackClientImpl.java delete mode 100644 Mage.Common/src/mage/interfaces/MageClient.java delete mode 100644 Mage.Common/src/mage/interfaces/MageServer.java delete mode 100644 Mage.Common/src/mage/remote/Session.java delete mode 100644 Mage.Common/src/mage/remote/SessionImpl.java diff --git a/Mage.Client/src/main/java/mage/client/MageFrame.java b/Mage.Client/src/main/java/mage/client/MageFrame.java index d359f0cc338..7ffffb3008b 100644 --- a/Mage.Client/src/main/java/mage/client/MageFrame.java +++ b/Mage.Client/src/main/java/mage/client/MageFrame.java @@ -162,13 +162,10 @@ public class MageFrame extends javax.swing.JFrame implements MageClient { private static MageFrame instance; -// private static Session session; -// public static MageClient client; private static Client client; private ServerState serverState; private ConnectDialog connectDialog; private final ErrorDialog errorDialog; -// private static CallbackClient callbackClient; private static final Preferences prefs = Preferences.userNodeForPackage(MageFrame.class); private JLabel title; private Rectangle titleRectangle; @@ -185,22 +182,14 @@ public class MageFrame extends javax.swing.JFrame implements MageClient { private static final Map drafts = new HashMap<>(); private static final MageUI ui = new MageUI(); -// private static final ScheduledExecutorService pingTaskExecutor = Executors.newSingleThreadScheduledExecutor(); private static UpdateMemUsageTask updateMemUsageTask; private static long startTime; -// /** -// * @return the session -// */ -// public static Session getSession() { -// return session; -// } - public static Client getClient() { return client; } - + public static JDesktopPane getDesktop() { return desktopPane; } @@ -230,7 +219,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient { */ public MageFrame() { setWindowTitle(); - + clientId = UUID.randomUUID(); EDTExceptionHandler.registerExceptionHandler(); addWindowListener(new WindowAdapter() { @@ -263,8 +252,6 @@ public class MageFrame extends javax.swing.JFrame implements MageClient { DialogManager.updateParams(768, 1024, false); this.setExtendedState(JFrame.MAXIMIZED_BOTH); -// session = new SessionImpl(this); -// callbackClient = new CallbackClientImpl(this); connectDialog = new ConnectDialog(); desktopPane.add(connectDialog, JLayeredPane.POPUP_LAYER); errorDialog = new ErrorDialog(); @@ -272,13 +259,6 @@ public class MageFrame extends javax.swing.JFrame implements MageClient { desktopPane.add(errorDialog, JLayeredPane.POPUP_LAYER); ui.addComponent(MageComponents.DESKTOP_PANE, desktopPane); -// pingTaskExecutor.scheduleAtFixedRate(new Runnable() { -// @Override -// public void run() { -// session.ping(); -// } -// }, 60, 60, TimeUnit.SECONDS); - updateMemUsageTask = new UpdateMemUsageTask(jMemUsageLabel); try { @@ -621,7 +601,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient { if (activeFrame != frame) { frame.deactivated(); } - + } private static MagePane getTopMost(MagePane exclude) { @@ -824,10 +804,6 @@ public class MageFrame extends javax.swing.JFrame implements MageClient { } return result; } - -// public static boolean stopConnecting() { -// return session.stopConnecting(); -// } public boolean autoConnect() { boolean autoConnectParamValue = Boolean.parseBoolean(prefs.get("autoConnect", "false")); @@ -1420,14 +1396,6 @@ public class MageFrame extends javax.swing.JFrame implements MageClient { @Override public void disconnected(final boolean errorCall) { -// if (SwingUtilities.isEventDispatchThread()) { // Returns true if the current thread is an AWT event dispatching thread. -// logger.info("DISCONNECTED (Event Dispatch Thread)"); -// setStatusText("Not connected"); -// disableButtons(); -// hideGames(); -// hideTables(); -// } else { -// logger.info("DISCONNECTED (NO Event Dispatch Thread)"); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { @@ -1439,12 +1407,9 @@ public class MageFrame extends javax.swing.JFrame implements MageClient { if (performConnect()) { enableButtons(); } -// } else { -// client.disconnect(); } } }); -// } } public void showMessage(final String title, final String message) { @@ -1465,11 +1430,6 @@ public class MageFrame extends javax.swing.JFrame implements MageClient { }); } -// @Override -// public void processCallback(ClientCallback callback) { -// callbackClient.processCallback(callback); -// } - @Override public void inform(String title, String message, MessageType type) { if (type == MessageType.ERROR) { @@ -1506,13 +1466,6 @@ public class MageFrame extends javax.swing.JFrame implements MageClient { @Override public void clientRegistered(ServerState state) { this.serverState = state; -// SwingUtilities.invokeLater(new Runnable() { -// @Override -// public void run() { -// setWindowTitle(); -// showGames(false); -// } -// }); } @Override diff --git a/Mage.Client/src/main/java/mage/client/cards/Card.java b/Mage.Client/src/main/java/mage/client/cards/Card.java index f48e8b57f64..19b17d4044c 100644 --- a/Mage.Client/src/main/java/mage/client/cards/Card.java +++ b/Mage.Client/src/main/java/mage/client/cards/Card.java @@ -47,7 +47,6 @@ import mage.client.util.ImageHelper; import mage.client.util.gui.ArrowBuilder; import mage.constants.CardType; import mage.constants.EnlargeMode; -//import mage.remote.Session; import mage.view.*; import javax.swing.*; @@ -69,7 +68,6 @@ import org.mage.network.Client; @SuppressWarnings("serial") public class Card extends MagePermanent implements MouseMotionListener, MouseListener, FocusListener, ComponentListener { -// protected static Session session = MageFrame.getSession(); protected static Client client = MageFrame.getClient(); protected static DefaultActionCallback callback = DefaultActionCallback.getInstance(); diff --git a/Mage.Client/src/main/java/mage/client/cards/Cards.java b/Mage.Client/src/main/java/mage/client/cards/Cards.java index 9ff324f38ac..abe5da510c6 100644 --- a/Mage.Client/src/main/java/mage/client/cards/Cards.java +++ b/Mage.Client/src/main/java/mage/client/cards/Cards.java @@ -1,30 +1,30 @@ /* -* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. -* -* Redistribution and use in source and binary forms, with or without modification, are -* permitted provided that the following conditions are met: -* -* 1. Redistributions of source code must retain the above copyright notice, this list of -* conditions and the following disclaimer. -* -* 2. Redistributions in binary form must reproduce the above copyright notice, this list -* of conditions and the following disclaimer in the documentation and/or other materials -* provided with the distribution. -* -* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED -* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR -* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -* The views and conclusions contained in the software and documentation are those of the -* authors and should not be interpreted as representing official policies, either expressed -* or implied, of BetaSteward_at_googlemail.com. -*/ + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ /* * Cards.java diff --git a/Mage.Client/src/main/java/mage/client/chat/ChatPanel.java b/Mage.Client/src/main/java/mage/client/chat/ChatPanel.java index 330282331b6..279b2d838fc 100644 --- a/Mage.Client/src/main/java/mage/client/chat/ChatPanel.java +++ b/Mage.Client/src/main/java/mage/client/chat/ChatPanel.java @@ -53,7 +53,6 @@ import mage.client.util.audio.AudioManager; import mage.client.util.gui.countryBox.CountryCellRenderer; import mage.remote.MageRemoteException; import mage.view.ChatMessage; -//import mage.remote.Session; import mage.view.ChatMessage.MessageColor; import mage.view.ChatMessage.MessageType; import mage.view.RoomUsersView; @@ -388,7 +387,6 @@ public class ChatPanel extends javax.swing.JPanel { private UsersView[] players = new UsersView[0]; public void loadData(RoomUsersView roomUserInfo) throws MageRemoteException { -// RoomUsersView roomUserInfo = roomUserInfoList.iterator().next(); this.players = roomUserInfo.getUsersView().toArray(new UsersView[0]); JTableHeader th = jTablePlayers.getTableHeader(); TableColumnModel tcm = th.getColumnModel(); diff --git a/Mage.Client/src/main/java/mage/client/components/ability/AbilityPicker.java b/Mage.Client/src/main/java/mage/client/components/ability/AbilityPicker.java index 4c0b7e64417..1006e716f25 100644 --- a/Mage.Client/src/main/java/mage/client/components/ability/AbilityPicker.java +++ b/Mage.Client/src/main/java/mage/client/components/ability/AbilityPicker.java @@ -3,7 +3,6 @@ package mage.client.components.ability; import mage.client.util.ImageHelper; import mage.client.util.SettingsManager; import mage.client.util.gui.GuiDisplayUtil; -//import mage.remote.Session; import mage.view.AbilityPickerView; import org.apache.log4j.Logger; import org.jdesktop.layout.GroupLayout; diff --git a/Mage.Client/src/main/java/mage/client/deckeditor/DeckEditorPanel.java b/Mage.Client/src/main/java/mage/client/deckeditor/DeckEditorPanel.java index 284d183a11c..a3f26855596 100644 --- a/Mage.Client/src/main/java/mage/client/deckeditor/DeckEditorPanel.java +++ b/Mage.Client/src/main/java/mage/client/deckeditor/DeckEditorPanel.java @@ -70,7 +70,6 @@ import mage.client.util.Listener; import mage.client.util.audio.AudioManager; import mage.components.CardInfoPane; import mage.game.GameException; -//import mage.remote.Session; import mage.view.CardView; import mage.view.SimpleCardView; import org.apache.log4j.Logger; diff --git a/Mage.Client/src/main/java/mage/client/dialog/ConnectDialog.java b/Mage.Client/src/main/java/mage/client/dialog/ConnectDialog.java index 74718753058..70c2d76a4e4 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/ConnectDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/ConnectDialog.java @@ -404,7 +404,6 @@ public class ConnectDialog extends MageDialog { logger.fatal("Connection timeout: ", ex); lblStatus.setText("Could not connect"); } finally { -// MageFrame.stopConnecting(); btnConnect.setEnabled(true); } } diff --git a/Mage.Client/src/main/java/mage/client/dialog/JoinTableDialog.java b/Mage.Client/src/main/java/mage/client/dialog/JoinTableDialog.java index 04c19c82591..57bd9f9f8f4 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/JoinTableDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/JoinTableDialog.java @@ -31,7 +31,6 @@ import java.util.UUID; import javax.swing.JOptionPane; import mage.cards.decks.importer.DeckImporterUtil; import mage.client.MageFrame; -//import mage.remote.Session; import org.apache.log4j.Logger; import org.mage.network.Client; diff --git a/Mage.Client/src/main/java/mage/client/dialog/NewTableDialog.java b/Mage.Client/src/main/java/mage/client/dialog/NewTableDialog.java index c047c431084..7f2d2c87a53 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/NewTableDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/NewTableDialog.java @@ -48,7 +48,6 @@ import mage.constants.MultiplayerAttackOption; import mage.constants.RangeOfInfluence; import mage.constants.SkillLevel; import mage.game.match.MatchOptions; -//import mage.remote.Session; import mage.view.GameTypeView; import mage.view.TableView; import org.apache.log4j.Logger; diff --git a/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.java b/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.java index 796b15b9b7f..c423e76068b 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/NewTournamentDialog.java @@ -60,7 +60,6 @@ import mage.game.draft.DraftOptions; import mage.game.draft.DraftOptions.TimingOption; import mage.game.tournament.LimitedOptions; import mage.game.tournament.TournamentOptions; -//import mage.remote.Session; import mage.view.GameTypeView; import mage.view.TableView; import mage.view.TournamentTypeView; diff --git a/Mage.Client/src/main/java/mage/client/dialog/TableWaitingDialog.java b/Mage.Client/src/main/java/mage/client/dialog/TableWaitingDialog.java index b553361fd16..c7d3a634aa6 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/TableWaitingDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/TableWaitingDialog.java @@ -143,7 +143,6 @@ public class TableWaitingDialog extends MageDialog { this.btnMoveDown.setVisible(false); this.btnMoveUp.setVisible(false); } -// UUID chatId = client.getTableChatId(tableId); if (chatId != null) { this.chatPanel.connect(chatId); updateTask.execute(); diff --git a/Mage.Client/src/main/java/mage/client/dialog/UserRequestDialog.java b/Mage.Client/src/main/java/mage/client/dialog/UserRequestDialog.java index cc53bef7df4..d92240b3cd6 100644 --- a/Mage.Client/src/main/java/mage/client/dialog/UserRequestDialog.java +++ b/Mage.Client/src/main/java/mage/client/dialog/UserRequestDialog.java @@ -37,7 +37,6 @@ package mage.client.dialog; import mage.client.MageFrame; import mage.constants.PlayerAction; -//import mage.remote.Session; import mage.view.UserRequestMessage; import org.mage.network.Client; diff --git a/Mage.Client/src/main/java/mage/client/game/AbilityPicker.java b/Mage.Client/src/main/java/mage/client/game/AbilityPicker.java index 4e02dee9431..992c15c95d5 100644 --- a/Mage.Client/src/main/java/mage/client/game/AbilityPicker.java +++ b/Mage.Client/src/main/java/mage/client/game/AbilityPicker.java @@ -30,7 +30,6 @@ package mage.client.game; import mage.client.MageFrame; import mage.client.util.gui.GuiDisplayUtil; -//import mage.remote.Session; import mage.view.AbilityPickerView; import javax.swing.*; diff --git a/Mage.Client/src/main/java/mage/client/game/FeedbackPanel.java b/Mage.Client/src/main/java/mage/client/game/FeedbackPanel.java index d7b09f33f0d..a8ff601b2e6 100644 --- a/Mage.Client/src/main/java/mage/client/game/FeedbackPanel.java +++ b/Mage.Client/src/main/java/mage/client/game/FeedbackPanel.java @@ -49,7 +49,6 @@ import mage.client.util.audio.AudioManager; import mage.client.util.gui.ArrowBuilder; import mage.constants.Constants; import mage.constants.PlayerAction; -//import mage.remote.Session; import org.apache.log4j.Logger; import org.mage.network.Client; @@ -89,13 +88,6 @@ public class FeedbackPanel extends javax.swing.JPanel { } public void getFeedback(FeedbackMode mode, String message, boolean special, Map options) { -// synchronized (this) { -// if (messageId < this.lastMessageId) { -// logger.warn("ignoring message from later source: " + messageId + ", text=" + message); -// return; -// } -// this.lastMessageId = messageId; -// } this.lblMessage.setText(message); this.helper.setMessage(message); 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 7aee90e37ce..d0b9a67cb55 100644 --- a/Mage.Client/src/main/java/mage/client/game/PlayerPanelExt.java +++ b/Mage.Client/src/main/java/mage/client/game/PlayerPanelExt.java @@ -70,7 +70,6 @@ import mage.client.util.gui.BufferedImageBuilder; import mage.client.util.gui.countryBox.CountryUtil; import mage.components.ImagePanel; import mage.constants.ManaType; -//import mage.remote.Session; import mage.utils.timer.PriorityTimer; import mage.view.ManaPoolView; import mage.view.PlayerView; diff --git a/Mage.Client/src/main/java/mage/client/plugins/adapters/MageActionCallback.java b/Mage.Client/src/main/java/mage/client/plugins/adapters/MageActionCallback.java index 151d3adc86c..abb831237c9 100644 --- a/Mage.Client/src/main/java/mage/client/plugins/adapters/MageActionCallback.java +++ b/Mage.Client/src/main/java/mage/client/plugins/adapters/MageActionCallback.java @@ -38,7 +38,6 @@ import mage.client.util.gui.ArrowUtil; import mage.client.util.gui.GuiDisplayUtil; import mage.components.CardInfoPane; import mage.constants.EnlargeMode; -//import mage.remote.Session; import mage.utils.ThreadUtils; import mage.view.CardView; import mage.view.PermanentView; diff --git a/Mage.Client/src/main/java/mage/client/remote/CallbackClientImpl.java b/Mage.Client/src/main/java/mage/client/remote/CallbackClientImpl.java deleted file mode 100644 index ba8fc6353d1..00000000000 --- a/Mage.Client/src/main/java/mage/client/remote/CallbackClientImpl.java +++ /dev/null @@ -1,495 +0,0 @@ -/* - * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, are - * permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this list of - * conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, this list - * of conditions and the following disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * The views and conclusions contained in the software and documentation are those of the - * authors and should not be interpreted as representing official policies, either expressed - * or implied, of BetaSteward_at_googlemail.com. - */ -//package mage.client.remote; -// -//import java.util.List; -//import java.util.UUID; -//import javax.swing.JOptionPane; -//import javax.swing.SwingUtilities; -//import mage.client.MageFrame; -//import mage.client.draft.DraftPanel; -//import mage.client.game.GamePanel; -//import mage.client.util.audio.AudioManager; -//import mage.client.util.object.SaveObjectUtil; -//import mage.interfaces.callback.CallbackClient; -//import mage.interfaces.callback.ClientCallback; -//import mage.utils.CompressUtil; -//import mage.view.ChatMessage; -//import mage.view.DraftClientMessage; -//import mage.view.DraftView; -//import mage.view.GameView; -//import mage.view.TableClientMessage; -//import mage.view.UserRequestMessage; -//import org.apache.log4j.Logger; -// -///** -// * -// * @author BetaSteward_at_googlemail.com -// */ -//public class CallbackClientImpl implements CallbackClient { -// -// private static final Logger logger = Logger.getLogger(CallbackClientImpl.class); -// private final MageFrame frame; -// private int messageId = 0; -// private int gameInformMessageId = 0; -// -// public CallbackClientImpl(MageFrame frame) { -// this.frame = frame; -// } -// -// @Override -// public synchronized void processCallback(final ClientCallback callback) { -// SaveObjectUtil.saveObject(callback.getData(), callback.getMethod()); -// callback.setData(CompressUtil.decompress(callback.getData())); -// SwingUtilities.invokeLater(new Runnable() { -// @Override -// public void run() { -// try { -// logger.debug(callback.getMessageId() + " -- " + callback.getMethod()); -// switch (callback.getMethod()) { -// case "startGame": -// { -// TableClientMessage message = (TableClientMessage) callback.getData(); -// GameManager.getInstance().setCurrentPlayerUUID(message.getPlayerId()); -// gameStarted(message.getGameId(), message.getPlayerId()); -// break; -// } -// case "startTournament": -// { -// TableClientMessage message = (TableClientMessage) callback.getData(); -// tournamentStarted(message.getGameId(), message.getPlayerId()); -// break; -// } -// case "startDraft": -// { -// TableClientMessage message = (TableClientMessage) callback.getData(); -// draftStarted(message.getGameId(), message.getPlayerId()); -// break; -// } -// case "replayGame": -// replayGame(callback.getObjectId()); -// break; -// case "showTournament": -// showTournament(callback.getObjectId()); -// break; -// case "watchGame": -// watchGame(callback.getObjectId()); -// break; -// case "chatMessage": -// { -// ChatMessage message = (ChatMessage) callback.getData(); -// ChatPanel panel = MageFrame.getChat(callback.getObjectId()); -// if (panel != null) { -// // play the to the message connected sound -// if (message.getSoundToPlay() != null) { -// switch (message.getSoundToPlay()) { -// case PlayerLeft: -// AudioManager.playPlayerLeft(); -// break; -// case PlayerQuitTournament: -// AudioManager.playPlayerQuitTournament(); -// break; -// case PlayerSubmittedDeck: -// AudioManager.playPlayerSubmittedDeck(); -// break; -// case PlayerWhispered: -// AudioManager.playPlayerWhispered(); -// break; -// } -// } -// // send start message to chat if not done yet -// if (!panel.isStartMessageDone()) { -// createChatStartMessage(panel); -// } -// // send the message to subchat if exists and it's not a game message -// if (!message.getMessageType().equals(MessageType.GAME) && panel.getConnectedChat() != null) { -// panel.getConnectedChat().receiveMessage(message.getUsername(), message.getMessage(), message.getTime(), message.getMessageType(), ChatMessage.MessageColor.BLACK); -// } else { -// panel.receiveMessage(message.getUsername(), message.getMessage(), message.getTime(), message.getMessageType(), message.getColor()); -// } -// -// } break; -// } -// case "serverMessage": -// if (callback.getData() != null) { -// ChatMessage message = (ChatMessage) callback.getData(); -// if (message.getColor().equals(ChatMessage.MessageColor.RED)) { -// JOptionPane.showMessageDialog(null, message.getMessage(), "Server message", JOptionPane.WARNING_MESSAGE); -// } else { -// JOptionPane.showMessageDialog(null, message.getMessage(), "Server message", JOptionPane.INFORMATION_MESSAGE); -// } -// } break; -// case "joinedTable": -// { -// TableClientMessage message = (TableClientMessage) callback.getData(); -// joinedTable(message.getRoomId(), message.getTableId(), message.getFlag()); -// break; -// } -// case "replayInit": -// { -// GamePanel panel = MageFrame.getGame(callback.getObjectId()); -// if (panel != null) { -// panel.init((GameView) callback.getData()); -// } break; -// } -// case "replayDone": -// { -// GamePanel panel = MageFrame.getGame(callback.getObjectId()); -// if (panel != null) { -// panel.endMessage((String) callback.getData()); -// } break; -// } -// case "replayUpdate": -// { -// GamePanel panel = MageFrame.getGame(callback.getObjectId()); -// if (panel != null) { -// panel.updateGame((GameView) callback.getData()); -// } break; -// } -// case "gameInit": -// { -// GamePanel panel = MageFrame.getGame(callback.getObjectId()); -// if (panel != null) { -// panel.init((GameView) callback.getData()); -// } break; -// } -// case "gameOver": -// { -// GamePanel panel = MageFrame.getGame(callback.getObjectId()); -// if (panel != null) { -// panel.endMessage((String) callback.getData()); -// } break; -// } -// case "gameError": -// frame.showErrorDialog("Game Error", (String) callback.getData()); -// break; -// case "gameAsk": -// { -// GameClientMessage message = (GameClientMessage) callback.getData(); -// GamePanel panel = MageFrame.getGame(callback.getObjectId()); -// if (panel != null) { -// panel.ask(message.getMessage(), message.getGameView(), callback.getMessageId()); -// } break; -// } -// case "gameTarget": // e.g. Pick triggered ability -// { -// GameClientMessage message = (GameClientMessage) callback.getData(); -// GamePanel panel = MageFrame.getGame(callback.getObjectId()); -// if (panel != null) { -// panel.pickTarget(message.getMessage(), message.getCardsView(), message.getGameView(), -// message.getTargets(), message.isFlag(), message.getOptions(), callback.getMessageId()); -// } break; -// } -// case "gameSelect": -// { -// GameClientMessage message = (GameClientMessage) callback.getData(); -// GamePanel panel = MageFrame.getGame(callback.getObjectId()); -// if (panel != null) { -// panel.select(message.getMessage(), message.getGameView(), callback.getMessageId(), message.getOptions()); -// } break; -// } -// case "gameChooseAbility": -// { -// GamePanel panel = MageFrame.getGame(callback.getObjectId()); -// if (panel != null) { -// panel.pickAbility((AbilityPickerView) callback.getData()); -// } break; -// } -// case "gameChoosePile": -// { -// GameClientMessage message = (GameClientMessage) callback.getData(); -// GamePanel panel = MageFrame.getGame(callback.getObjectId()); -// if (panel != null) { -// panel.pickPile(message.getMessage(), message.getPile1(), message.getPile2()); -// } break; -// } -// case "gameChooseChoice": -// { -// GameClientMessage message = (GameClientMessage) callback.getData(); -// GamePanel panel = MageFrame.getGame(callback.getObjectId()); -// -// if (panel != null) { -// panel.getChoice(message.getChoice(), callback.getObjectId()); -// } -// break; -// } -// case "gamePlayMana": -// { -// GameClientMessage message = (GameClientMessage) callback.getData(); -// GamePanel panel = MageFrame.getGame(callback.getObjectId()); -// if (panel != null) { -// panel.playMana(message.getMessage(), message.getGameView(), callback.getMessageId()); -// } -// break; -// } -// case "gamePlayXMana": -// { -// GameClientMessage message = (GameClientMessage) callback.getData(); -// GamePanel panel = MageFrame.getGame(callback.getObjectId()); -// if (panel != null) { -// panel.playXMana(message.getMessage(), message.getGameView(), callback.getMessageId()); -// } -// break; -// } -// case "gameSelectAmount": -// { -// GameClientMessage message = (GameClientMessage) callback.getData(); -// GamePanel panel = MageFrame.getGame(callback.getObjectId()); -// if (panel != null) { -// panel.getAmount(message.getMin(), message.getMax(), message.getMessage()); -// } break; -// } -// case "gameUpdate": -// { -// GamePanel panel = MageFrame.getGame(callback.getObjectId()); -// if (panel != null) { -// panel.updateGame((GameView) callback.getData()); -// } break; -// } -// case "endGameInfo": -// MageFrame.getInstance().showGameEndDialog((GameEndView) callback.getData()); -// break; -// case "showUserMessage": -// List messageData = (List) callback.getData(); -// if (messageData.size() == 2) { -// JOptionPane.showMessageDialog(null, messageData.get(1), messageData.get(0), JOptionPane.WARNING_MESSAGE); -// } break; -// case "gameInform": -// if (callback.getMessageId() > gameInformMessageId) { -// { -// GameClientMessage message = (GameClientMessage) callback.getData(); -// GamePanel panel = MageFrame.getGame(callback.getObjectId()); -// if (panel != null) { -// panel.inform(message.getMessage(), message.getGameView()); -// } -// } -//// no longer needed because phase skip handling on server side now -// } else { -// logger.warn(new StringBuilder("message out of sequence - ignoring").append("MessageId = ").append(callback.getMessageId()).append(" method = ").append(callback.getMethod())); -// //logger.warn("message out of sequence - ignoring"); -// } -// gameInformMessageId = messageId; -// break; -// case "gameInformPersonal": -// { -// GameClientMessage message = (GameClientMessage) callback.getData(); -// GamePanel panel = MageFrame.getGame(callback.getObjectId()); -// if (panel != null) { -// JOptionPane.showMessageDialog(panel, message.getMessage(), "Game message", -// JOptionPane.INFORMATION_MESSAGE); -// } break; -// } -// case "sideboard": -// { -// TableClientMessage message = (TableClientMessage) callback.getData(); -// DeckView deckView = message.getDeck(); -// Deck deck = DeckUtil.construct(deckView); -// if (message.getFlag()) { -// construct(deck, message.getTableId(), message.getTime()); -// } else { -// sideboard(deck, message.getTableId(), message.getTime()); -// } break; -// } -// case "construct": -// { -// TableClientMessage message = (TableClientMessage) callback.getData(); -// DeckView deckView = message.getDeck(); -// Deck deck = DeckUtil.construct(deckView); -// construct(deck, message.getTableId(), message.getTime()); -// break; -// } -// case "draftOver": -// MageFrame.removeDraft(callback.getObjectId()); -// break; -// case "draftPick": -// { -// DraftClientMessage message = (DraftClientMessage) callback.getData(); -// DraftPanel panel = MageFrame.getDraft(callback.getObjectId()); -// if (panel != null) { -// panel.loadBooster(message.getDraftPickView()); -// } -// break; -// } -// case "draftUpdate": -// { -// DraftPanel panel = MageFrame.getDraft(callback.getObjectId()); -// if (panel != null) { -// panel.updateDraft((DraftView) callback.getData()); -// } -// break; -// } -// case "draftInform": -// if (callback.getMessageId() > messageId) { -// { -// DraftClientMessage message = (DraftClientMessage) callback.getData(); -// } -// } else { -// logger.warn("message out of sequence - ignoring"); -// } -// break; -// case "draftInit": -// { -// DraftClientMessage message = (DraftClientMessage) callback.getData(); -// DraftPanel panel = MageFrame.getDraft(callback.getObjectId()); -// if (panel != null) { -// panel.loadBooster(message.getDraftPickView()); -// } -// break; -// } -// case "tournamentInit": -// break; -// case "userRequestDialog": -// frame.showUserRequestDialog((UserRequestMessage) callback.getData()); -// break; -// } -// messageId = callback.getMessageId(); -// } catch (Exception ex) { -// handleException(ex); -// } -// } -// }); -// } -// -// private void createChatStartMessage(ChatPanel chatPanel) { -// chatPanel.setStartMessageDone(true); -// ChatPanel usedPanel = chatPanel; -// if (chatPanel.getConnectedChat() != null) { -// usedPanel = chatPanel.getConnectedChat(); -// } -// switch (usedPanel.getChatType()) { -// case GAME: -// usedPanel.receiveMessage("", new StringBuilder("You may use hot keys to play faster:") -// .append("
Turn mousewheel up (ALT-e) - enlarge image of card the mousepointer hovers over") -// .append("
Turn mousewheel down (ALT-s) - enlarge original/alternate image of card the mousepointer hovers over") -// .append("
F2 - Confirm \"Ok\", \"Yes\" or \"Done\" button") -// .append("
F4 - Skip current turn but stop on declare attackers/blockers and something on the stack") -// .append("
F5 - Skip to next end step but stop on declare attackers/blockers and something on the stack") -// .append("
F7 - Skip to next main phase but stop on declare attackers/blockers and something on the stack") -// .append("
F9 - Skip everything until your next turn") -// .append("
F3 - Undo F4/F5/F7/F9").toString(), -// null, MessageType.USER_INFO, ChatMessage.MessageColor.BLUE); -// break; -// case TOURNAMENT: -// usedPanel.receiveMessage("", new StringBuilder("On this panel you can see the players, their state and the results of the games of the tournament. Also you can chat with the competitors of the tournament.").toString(), -// null, MessageType.USER_INFO, ChatMessage.MessageColor.BLUE); -// break; -// case TABLES: -// usedPanel.receiveMessage("", new StringBuilder("Download card images by using the \"Images\" menu to the top right .") -// .append("
Download icons and symbols by using the \"Symbols\" menu to the top right.") -// .append("
\\list - Show a list of available chat commands.").toString(), -// null, MessageType.USER_INFO, ChatMessage.MessageColor.BLUE); -// break; -// -// } -// } - -// private void joinedTable(UUID roomId, UUID tableId, boolean isTournament) { -// try { -// frame.showTableWaitingDialog(roomId, tableId, isTournament); -// } catch (Exception ex) { -// handleException(ex); -// } -// } - -// protected void gameStarted(final UUID gameId, final UUID playerId) { -// try { -// frame.showGame(gameId, playerId); -// logger.info("Game " + gameId + " started for player " + playerId); -// } catch (Exception ex) { -// handleException(ex); -// } -// -// if (Plugins.getInstance().isCounterPluginLoaded()) { -// Plugins.getInstance().addGamesPlayed(); -// } -// } -// -// protected void draftStarted(UUID draftId, UUID playerId) { -// try { -// frame.showDraft(draftId); -// logger.info("Draft " + draftId + " started for player " + playerId); -// } catch (Exception ex) { -// handleException(ex); -// } -// } -// -// protected void tournamentStarted(UUID tournamentId, UUID playerId) { -// try { -// frame.showTournament(tournamentId); -// AudioManager.playTournamentStarted(); -// logger.info("Tournament " + tournamentId + " started for player " + playerId); -// } catch (Exception ex) { -// handleException(ex); -// } -// } -// -// /** -// * Shows the tournament info panel for a tournament -// * -// * @param tournamentId -// */ -// protected void showTournament(UUID tournamentId) { -// try { -// frame.showTournament(tournamentId); -// logger.info("Showing tournament " + tournamentId); -// } catch (Exception ex) { -// handleException(ex); -// } -// } -// -// protected void watchGame(UUID gameId) { -// try { -// frame.watchGame(gameId); -// logger.info("Watching game " + gameId); -// } catch (Exception ex) { -// handleException(ex); -// } -// } -// -// protected void replayGame(UUID gameId) { -// try { -// frame.replayGame(gameId); -// logger.info("Replaying game"); -// } catch (Exception ex) { -// handleException(ex); -// } -// } -// -// protected void sideboard(Deck deck, UUID tableId, int time) { -// frame.showDeckEditor(DeckEditorMode.SIDEBOARDING, deck, tableId, time); -// } -// -// protected void construct(Deck deck, UUID tableId, int time) { -// frame.showDeckEditor(DeckEditorMode.LIMITED_BUILDING, deck, tableId, time); -// } - -// private void handleException(Exception ex) { -// logger.fatal("Client error\n", ex); -// frame.showError("Error: " + ex.getMessage()); -// } -//} diff --git a/Mage.Client/src/main/java/mage/client/table/TablePlayerPanel.java b/Mage.Client/src/main/java/mage/client/table/TablePlayerPanel.java index a450981d761..7e686c39dbd 100644 --- a/Mage.Client/src/main/java/mage/client/table/TablePlayerPanel.java +++ b/Mage.Client/src/main/java/mage/client/table/TablePlayerPanel.java @@ -44,7 +44,6 @@ import mage.client.util.Config; import mage.client.util.Event; import mage.client.util.Listener; import org.mage.network.Client; -//import mage.remote.Session; /** * diff --git a/Mage.Client/src/main/java/mage/client/table/TablesPanel.java b/Mage.Client/src/main/java/mage/client/table/TablesPanel.java index e0ccd97a663..707b0697bfa 100644 --- a/Mage.Client/src/main/java/mage/client/table/TablesPanel.java +++ b/Mage.Client/src/main/java/mage/client/table/TablesPanel.java @@ -88,7 +88,6 @@ import mage.constants.RangeOfInfluence; import mage.constants.SkillLevel; import mage.game.match.MatchOptions; import mage.remote.MageRemoteException; -//import mage.remote.Session; import mage.view.MatchView; import mage.view.RoomUsersView; import mage.view.RoomView; @@ -108,8 +107,6 @@ public class TablesPanel extends javax.swing.JPanel { private MatchesTableModel matchesModel; private UUID roomId; private UpdateRoomTask updateRoomTask; -// private UpdatePlayersTask updatePlayersTask; -// private UpdateMatchesTask updateMatchesTask; private JoinTableDialog joinTableDialog; private NewTableDialog newTableDialog; private NewTournamentDialog newTournamentDialog; @@ -377,21 +374,6 @@ public class TablesPanel extends javax.swing.JPanel { updateRoomTask = new UpdateRoomTask(client, roomId, this, this.chatPanel); updateRoomTask.execute(); } -// if (updatePlayersTask == null || updatePlayersTask.isDone()) { -// updatePlayersTask = new UpdatePlayersTask(client, roomId, this.chatPanel); -// updatePlayersTask.execute(); -// } -// if (this.btnStateFinished.isSelected()) { -// if (updateMatchesTask == null || updateMatchesTask.isDone()) { -// updateMatchesTask = new UpdateMatchesTask(client, roomId, this); -// updateMatchesTask.execute(); -// } -// } -// else { -// if (updateMatchesTask != null) { -// updateMatchesTask.cancel(true); -// } -// } } } @@ -399,12 +381,6 @@ public class TablesPanel extends javax.swing.JPanel { if (updateRoomTask != null) { updateRoomTask.cancel(true); } -// if (updatePlayersTask != null) { -// updatePlayersTask.cancel(true); -// } -// if (updateMatchesTask != null) { -// updateMatchesTask.cancel(true); -// } } public void showTables(UUID roomId) { @@ -1416,45 +1392,6 @@ class UpdateRoomTask extends SwingWorker { } -//class UpdatePlayersTask extends SwingWorker> { -// -// private final Client client; -// private final UUID roomId; -// private final ChatPanel chat; -// -// private static final Logger logger = Logger.getLogger(UpdatePlayersTask.class); -// -// UpdatePlayersTask(Client client, UUID roomId, ChatPanel chat) { -// this.client = client; -// this.roomId = roomId; -// this.chat = chat; -// } -// -// @Override -// protected Void doInBackground() throws Exception { -// while (!isCancelled()) { -// this.publish(client.getRoomUsers(roomId)); -// Thread.sleep(3000); -// } -// return null; -// } -// -// @Override -// protected void process(List> roomUserInfo) { -// chat.setRoomUserInfo(roomUserInfo); -// } -// -// @Override -// protected void done() { -// try { -// get(); -// } catch (InterruptedException | ExecutionException ex) { -// logger.fatal("Update Players Task error", ex); -// } catch (CancellationException ex) {} -// } -// -//} - class MatchesTableModel extends AbstractTableModel { public static final int ACTION_COLUMN = 6; // column the action is located (starting with 0) @@ -1556,48 +1493,6 @@ class MatchesTableModel extends AbstractTableModel { } -//class UpdateMatchesTask extends SwingWorker> { -// -// private final Client client; -// private final UUID roomId; -// private final TablesPanel panel; -// -// private static final Logger logger = Logger.getLogger(UpdateTablesTask.class); -// -// UpdateMatchesTask(Client client, UUID roomId, TablesPanel panel) { -// this.client = client; -// this.roomId = roomId; -// this.panel = panel; -// } -// -// @Override -// protected Void doInBackground() throws Exception { -// while (!isCancelled()) { -// Collection matches = client.getFinishedMatches(roomId); -// if (matches != null) { -// this.publish(matches); -// } -// Thread.sleep(10000); -// } -// return null; -// } -// -// @Override -// protected void process(List> view) { -// panel.updateMatches(view.get(0)); -// } -// -// @Override -// protected void done() { -// try { -// get(); -// } catch (InterruptedException | ExecutionException ex) { -// logger.fatal("Update Matches Task error", ex); -// } catch (CancellationException ex) {} -// } -// -//} - class GameChooser extends JPopupMenu { private Client client; diff --git a/Mage.Client/src/main/java/mage/client/table/TournamentPlayerPanel.java b/Mage.Client/src/main/java/mage/client/table/TournamentPlayerPanel.java index 2d2e69be2e8..3d2e357a22c 100644 --- a/Mage.Client/src/main/java/mage/client/table/TournamentPlayerPanel.java +++ b/Mage.Client/src/main/java/mage/client/table/TournamentPlayerPanel.java @@ -41,7 +41,6 @@ import mage.cards.decks.DeckCardLists; import mage.cards.decks.importer.DeckImporterUtil; import mage.client.MageFrame; import org.mage.network.Client; -//import mage.remote.Session; /** * diff --git a/Mage.Client/src/main/java/mage/client/unusedFiles/PlayerPanel.java b/Mage.Client/src/main/java/mage/client/unusedFiles/PlayerPanel.java index 6527ed7d22a..12cf2e823cb 100644 --- a/Mage.Client/src/main/java/mage/client/unusedFiles/PlayerPanel.java +++ b/Mage.Client/src/main/java/mage/client/unusedFiles/PlayerPanel.java @@ -41,7 +41,6 @@ import mage.client.MageFrame; import mage.client.cards.BigCard; import mage.client.dialog.ShowCardsDialog; import mage.client.util.Config; -//import mage.remote.Session; import mage.view.PlayerView; import org.mage.network.Client; diff --git a/Mage.Client/src/main/java/mage/client/util/DefaultActionCallback.java b/Mage.Client/src/main/java/mage/client/util/DefaultActionCallback.java index eb969f293ff..62084976807 100644 --- a/Mage.Client/src/main/java/mage/client/util/DefaultActionCallback.java +++ b/Mage.Client/src/main/java/mage/client/util/DefaultActionCallback.java @@ -3,7 +3,6 @@ package mage.client.util; import java.awt.event.MouseEvent; import java.util.UUID; -//import mage.remote.Session; import mage.view.CardView; import org.mage.network.Client; diff --git a/Mage.Client/src/test/java/mage/client/game/MultiConnectTest.java b/Mage.Client/src/test/java/mage/client/game/MultiConnectTest.java index 6f9da615e70..51be123cb69 100644 --- a/Mage.Client/src/test/java/mage/client/game/MultiConnectTest.java +++ b/Mage.Client/src/test/java/mage/client/game/MultiConnectTest.java @@ -97,11 +97,6 @@ public class MultiConnectTest { logger.info("showError: " + message); } -// @Override -// public void processCallback(ClientCallback callback) { -// logger.info("processCallback"); -// } - @Override public void inform(String title, String message, MessageType type) { if (type == MessageType.ERROR) { diff --git a/Mage.Common/src/mage/interfaces/MageClient.java b/Mage.Common/src/mage/interfaces/MageClient.java deleted file mode 100644 index 0c5695d311f..00000000000 --- a/Mage.Common/src/mage/interfaces/MageClient.java +++ /dev/null @@ -1,46 +0,0 @@ -///* -//* Copyright 2011 BetaSteward_at_googlemail.com. All rights reserved. -//* -//* Redistribution and use in source and binary forms, with or without modification, are -//* permitted provided that the following conditions are met: -//* -//* 1. Redistributions of source code must retain the above copyright notice, this list of -//* conditions and the following disclaimer. -//* -//* 2. Redistributions in binary form must reproduce the above copyright notice, this list -//* of conditions and the following disclaimer in the documentation and/or other materials -//* provided with the distribution. -//* -//* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED -//* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -//* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR -//* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -//* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -//* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -//* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -//* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -//* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -//* -//* The views and conclusions contained in the software and documentation are those of the -//* authors and should not be interpreted as representing official policies, either expressed -//* or implied, of BetaSteward_at_googlemail.com. -//*/ -// -//package mage.interfaces; -// -//import mage.interfaces.callback.CallbackClient; -//import mage.utils.MageVersion; -// -///** -// * -// * @author BetaSteward_at_googlemail.com -// */ -//public interface MageClient extends CallbackClient { -// -// MageVersion getVersion(); -// void connected(String message); -// void disconnected(boolean errorCall); -// void showMessage(String message); -// void showError(String message); -// -//} diff --git a/Mage.Common/src/mage/interfaces/MageServer.java b/Mage.Common/src/mage/interfaces/MageServer.java deleted file mode 100644 index 1719435ca22..00000000000 --- a/Mage.Common/src/mage/interfaces/MageServer.java +++ /dev/null @@ -1,158 +0,0 @@ -///* -//* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. -//* -//* Redistribution and use in source and binary forms, with or without modification, are -//* permitted provided that the following conditions are met: -//* -//* 1. Redistributions of source code must retain the above copyright notice, this list of -//* conditions and the following disclaimer. -//* -//* 2. Redistributions in binary form must reproduce the above copyright notice, this list -//* of conditions and the following disclaimer in the documentation and/or other materials -//* provided with the distribution. -//* -//* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED -//* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -//* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR -//* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -//* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -//* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -//* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -//* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -//* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -//* -//* The views and conclusions contained in the software and documentation are those of the -//* authors and should not be interpreted as representing official policies, either expressed -//* or implied, of BetaSteward_at_googlemail.com. -//*/ -// -//package mage.interfaces; -// -//import java.util.List; -//import java.util.Set; -//import java.util.UUID; -//import mage.MageException; -//import mage.cards.decks.DeckCardLists; -//import mage.cards.repository.CardInfo; -//import mage.cards.repository.ExpansionInfo; -//import mage.constants.ManaType; -//import mage.constants.PlayerAction; -//import mage.game.GameException; -//import mage.game.match.MatchOptions; -//import mage.game.tournament.TournamentOptions; -//import mage.utils.MageVersion; -//import mage.view.DraftPickView; -//import mage.view.GameView; -//import mage.view.MatchView; -//import mage.view.TableView; -//import mage.view.TournamentView; -//import mage.view.UserDataView; -//import mage.view.RoomUsersView; -//import mage.view.UserView; -// -///** -// * -// * @author BetaSteward_at_googlemail.com -// */ -//public interface MageServer { -// -// // connection methods -// boolean registerClient(String userName, String sessionId, MageVersion version) throws MageException; -// boolean registerAdmin(String password, String sessionId, MageVersion version) throws MageException; -//// Not used -//// void deregisterClient(String sessionId) throws MageException; -// -// // update methods -// List getMissingExpansionData(List codes); -// List getMissingCardsData(List classNames); -// -// // user methods -// boolean setUserData(String userName, String sessionId, UserDataView userDataView) throws MageException; -// void sendFeedbackMessage(String sessionId, String username, String title, String type, String message, String email) throws MageException; -// -// // server state methods -// ServerState getServerState() throws MageException; -// List getRoomUsers(UUID roomId) throws MageException; -// List getFinishedMatches(UUID roomId) throws MageException; -// Object getServerMessagesCompressed(String sessionId) throws MageException; // messages of the day -// -// // ping - extends session -// boolean ping(String sessionId, String pingInfo) throws MageException; -// -// //table methods -// TableView createTable(String sessionId, UUID roomId, MatchOptions matchOptions) throws MageException; -// TableView createTournamentTable(String sessionId, UUID roomId, TournamentOptions tournamentOptions) throws MageException; -// boolean joinTable(String sessionId, UUID roomId, UUID tableId, String name, String playerType, int skill, DeckCardLists deckList, String password) throws MageException, GameException; -// boolean joinTournamentTable(String sessionId, UUID roomId, UUID tableId, String name, String playerType, int skill, DeckCardLists deckList, String password) throws MageException, GameException; -// boolean submitDeck(String sessionId, UUID tableId, DeckCardLists deckList) throws MageException, GameException; -// void updateDeck(String sessionId, UUID tableId, DeckCardLists deckList) throws MageException, GameException; -// boolean watchTable(String sessionId, UUID roomId, UUID tableId) throws MageException; -// boolean watchTournamentTable(String sessionId, UUID tableId) throws MageException; -// boolean leaveTable(String sessionId, UUID roomId, UUID tableId) throws MageException; -// void swapSeats(String sessionId, UUID roomId, UUID tableId, int seatNum1, int seatNum2) throws MageException; -// void removeTable(String sessionId, UUID roomId, UUID tableId) throws MageException; -// boolean isTableOwner(String sessionId, UUID roomId, UUID tableId) throws MageException; -// TableView getTable(UUID roomId, UUID tableId) throws MageException; -// List getTables(UUID roomId) throws MageException; -// -// //chat methods -// void sendChatMessage(UUID chatId, String userName, String message) throws MageException; -// void joinChat(UUID chatId, String sessionId, String userName) throws MageException; -// void leaveChat(UUID chatId, String sessionId) throws MageException; -// UUID getTableChatId(UUID tableId) throws MageException; -// UUID getGameChatId(UUID gameId) throws MageException; -// UUID getRoomChatId(UUID roomId) throws MageException; -// UUID getTournamentChatId(UUID tournamentId) throws MageException; -// -// //room methods -// UUID getMainRoomId() throws MageException; -// -// //game methods -// boolean startMatch(String sessionId, UUID roomId, UUID tableId) throws MageException; -// void joinGame(UUID gameId, String sessionId) throws MageException; -// void watchGame(UUID gameId, String sessionId) throws MageException; -// void stopWatching(UUID gameId, String sessionId) throws MageException; -// void sendPlayerUUID(UUID gameId, String sessionId, UUID data) throws MageException; -// void sendPlayerString(UUID gameId, String sessionId, String data) throws MageException; -// void sendPlayerBoolean(UUID gameId, String sessionId, Boolean data) throws MageException; -// void sendPlayerInteger(UUID gameId, String sessionId, Integer data) throws MageException; -// void sendPlayerManaType(UUID gameId, UUID playerId, String sessionId, ManaType data) throws MageException; -// void quitMatch(UUID gameId, String sessionId) throws MageException; -// GameView getGameView(UUID gameId, String sessionId, UUID playerId) throws MageException; -// // priority, undo, concede, mana pool -// void sendPlayerAction(PlayerAction playerAction, UUID gameId, String sessionId, Object data) throws MageException; -// -// //tournament methods -// boolean startTournament(String sessionId, UUID roomId, UUID tableId) throws MageException; -// void joinTournament(UUID draftId, String sessionId) throws MageException; -// void quitTournament(UUID tournamentId, String sessionId) throws MageException; -// TournamentView getTournament(UUID tournamentId) throws MageException; -// -// //draft methods -// void joinDraft(UUID draftId, String sessionId) throws MageException; -// void quitDraft(UUID draftId, String sessionId) throws MageException; -// DraftPickView sendCardPick(UUID draftId, String sessionId, UUID cardId, Set hiddenCards) throws MageException; -// void sendCardMark(UUID draftId, String sessionId, UUID cardId) throws MageException; -// -// //challenge methods -// // void startChallenge(String sessionId, UUID roomId, UUID tableId, UUID challengeId) throws MageException; -// -// //replay methods -// void replayGame(UUID gameId, String sessionId) throws MageException; -// void startReplay(UUID gameId, String sessionId) throws MageException; -// void stopReplay(UUID gameId, String sessionId) throws MageException; -// void nextPlay(UUID gameId, String sessionId) throws MageException; -// void previousPlay(UUID gameId, String sessionId) throws MageException; -// void skipForward(UUID gameId, String sessionId, int moves) throws MageException; -// -// //test methods -// void cheat(UUID gameId, String sessionId, UUID playerId, DeckCardLists deckList) throws MageException; -// boolean cheat(UUID gameId, String sessionId, UUID playerId, String cardName) throws MageException; -// -// //admin methods -// List getUsers(String sessionId) throws MageException; -// void disconnectUser(String sessionId, String userSessionId) throws MageException; -// void endUserSession(String sessionId, String userSessionId) throws MageException; -// void removeTable(String sessionId, UUID tableId) throws MageException; -// void sendBroadcastMessage(String sessionId, String message) throws MageException; -//} diff --git a/Mage.Common/src/mage/remote/Connection.java b/Mage.Common/src/mage/remote/Connection.java index 1d0c3f038d6..93bcb42a499 100644 --- a/Mage.Common/src/mage/remote/Connection.java +++ b/Mage.Common/src/mage/remote/Connection.java @@ -57,7 +57,7 @@ public class Connection implements Serializable { private boolean forceDBComparison; private UserDataView userData; - + // private int avatarId; // private boolean showAbilityPickerForced; // private boolean allowRequestShowHandCards; @@ -65,51 +65,6 @@ public class Connection implements Serializable { // private String flagName; // private UserSkipPrioritySteps userSkipPrioritySteps; -// private static final String serialization = "?serializationtype=jboss"; -// private static final String transport = "bisocket"; - -// private final String parameter; - -// public Connection() { -// this(""); -// } -// -// public Connection(String parameter) { -// this.parameter = parameter; -// } - -// @Override -// public int hashCode() { -// return (transport + host + Integer.toString(port) + proxyType.toString()).hashCode(); -// } -// -// @Override -// public boolean equals(Object object) { -// if (! (object instanceof Connection)) { -// return false; -// } -// Connection otherConnection = (Connection) object; -// return hashCode() == otherConnection.hashCode(); -// } -// -// @Override -// public String toString() { -// return host + ":" + Integer.toString(port) + "/" + serialization + parameter; -// } -// -// public String getURI() { -// if (host.equals("localhost")) { -// try { -// InetAddress inet = getLocalAddress(); -// if (inet != null) { -// return transport + "://" + inet.getHostAddress() + ":" + port + "/" + serialization + parameter; -// } -// } catch (SocketException ex) { -// // just use localhost if can't find local ip -// } -// } -// return transport + "://" + host + ":" + port + "/" + serialization + parameter; -// } public ProxyType getProxyType() { return proxyType; diff --git a/Mage.Common/src/mage/remote/Session.java b/Mage.Common/src/mage/remote/Session.java deleted file mode 100644 index dc1e5c55a2a..00000000000 --- a/Mage.Common/src/mage/remote/Session.java +++ /dev/null @@ -1,49 +0,0 @@ -///* -//* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. -//* -//* Redistribution and use in source and binary forms, with or without modification, are -//* permitted provided that the following conditions are met: -//* -//* 1. Redistributions of source code must retain the above copyright notice, this list of -//* conditions and the following disclaimer. -//* -//* 2. Redistributions in binary form must reproduce the above copyright notice, this list -//* of conditions and the following disclaimer in the documentation and/or other materials -//* provided with the distribution. -//* -//* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED -//* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -//* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR -//* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -//* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -//* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -//* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -//* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -//* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -//* -//* The views and conclusions contained in the software and documentation are those of the -//* authors and should not be interpreted as representing official policies, either expressed -//* or implied, of BetaSteward_at_googlemail.com. -//*/ -// -//package mage.remote; -// -//import mage.remote.interfaces.ChatSession; -//import mage.remote.interfaces.ClientData; -//import mage.remote.interfaces.Connect; -//import mage.remote.interfaces.Feedback; -//import mage.remote.interfaces.GamePlay; -//import mage.remote.interfaces.GameTypes; -//import mage.remote.interfaces.PlayerActions; -//import mage.remote.interfaces.Replays; -//import mage.remote.interfaces.ServerState; -//import mage.remote.interfaces.Testable; -// -///** -// * Extracted interface for SessionImpl class. -// * -// * @author noxx -// */ -//public interface Session extends ClientData, Connect, GamePlay, GameTypes, ServerState, ChatSession, Feedback, PlayerActions, Replays, Testable { -// -//} diff --git a/Mage.Common/src/mage/remote/SessionImpl.java b/Mage.Common/src/mage/remote/SessionImpl.java deleted file mode 100644 index d7d8efe1c95..00000000000 --- a/Mage.Common/src/mage/remote/SessionImpl.java +++ /dev/null @@ -1,1473 +0,0 @@ -///* -//* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. -//* -//* Redistribution and use in source and binary forms, with or without modification, are -//* permitted provided that the following conditions are met: -//* -//* 1. Redistributions of source code must retain the above copyright notice, this list of -//* conditions and the following disclaimer. -//* -//* 2. Redistributions in binary form must reproduce the above copyright notice, this list -//* of conditions and the following disclaimer in the documentation and/or other materials -//* provided with the distribution. -//* -//* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED -//* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -//* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR -//* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -//* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -//* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -//* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -//* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -//* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -//* -//* The views and conclusions contained in the software and documentation are those of the -//* authors and should not be interpreted as representing official policies, either expressed -//* or implied, of BetaSteward_at_googlemail.com. -//*/ -// -//package mage.remote; -// -//import java.io.IOException; -//import java.lang.reflect.UndeclaredThrowableException; -//import java.net.Authenticator; -//import java.net.ConnectException; -//import java.net.MalformedURLException; -//import java.net.PasswordAuthentication; -//import java.net.SocketException; -//import java.net.SocketTimeoutException; -//import java.util.Collection; -//import java.util.HashMap; -//import java.util.LinkedList; -//import java.util.List; -//import java.util.Map; -//import java.util.Set; -//import java.util.UUID; -//import java.util.concurrent.TimeUnit; -//import mage.MageException; -//import mage.cards.decks.DeckCardLists; -//import mage.cards.decks.InvalidDeckException; -//import mage.cards.repository.CardInfo; -//import mage.cards.repository.CardRepository; -//import mage.cards.repository.ExpansionInfo; -//import mage.cards.repository.ExpansionRepository; -//import mage.constants.Constants.SessionState; -//import mage.constants.ManaType; -//import mage.constants.PlayerAction; -//import mage.game.GameException; -//import mage.game.match.MatchOptions; -//import mage.game.tournament.TournamentOptions; -//import mage.interfaces.MageClient; -//import mage.interfaces.MageServer; -//import mage.interfaces.ServerState; -//import mage.interfaces.callback.ClientCallback; -//import mage.utils.CompressUtil; -//import mage.players.net.UserSkipPrioritySteps; -//import mage.view.DraftPickView; -//import mage.view.GameTypeView; -//import mage.view.MatchView; -//import mage.view.RoomUsersView; -//import mage.view.TableView; -//import mage.view.TournamentTypeView; -//import mage.view.TournamentView; -//import mage.view.UserDataView; -//import mage.view.UserView; -//import org.apache.log4j.Logger; -//import org.jboss.remoting.CannotConnectException; -//import org.jboss.remoting.Client; -//import org.jboss.remoting.ConnectionListener; -//import org.jboss.remoting.ConnectionValidator; -//import org.jboss.remoting.InvocationFailureException; -//import org.jboss.remoting.InvokerLocator; -//import org.jboss.remoting.Remoting; -//import org.jboss.remoting.callback.Callback; -//import org.jboss.remoting.callback.HandleCallbackException; -//import org.jboss.remoting.callback.InvokerCallbackHandler; -//import org.jboss.remoting.transport.bisocket.Bisocket; -//import org.jboss.remoting.transport.socket.SocketWrapper; -//import org.jboss.remoting.transporter.TransporterClient; -// -///** -// * -// * @author BetaSteward_at_googlemail.com -// */ -//public class SessionImpl implements Session { -// -// private static final Logger logger = Logger.getLogger(SessionImpl.class); -// -// private final MageClient client; -// -// private String sessionId; -// private MageServer server; -// private Client callbackClient; -// private CallbackHandler callbackHandler; -// private ServerState serverState; -// private SessionState sessionState = SessionState.DISCONNECTED; -// private Connection connection; -// private final static int PING_CYCLES = 10; -// private final LinkedList pingTime = new LinkedList<>(); -// private String pingInfo = ""; -// private static boolean debugMode = false; -// -// private boolean canceled = false; -// -// static { -// debugMode = System.getProperty("debug.mage") != null; -// } -// -// public SessionImpl(MageClient client) { -// this.client = client; -// } -// -// @Override -// public String getSessionId() { -// return sessionId; -// } -// -// @Override -// public synchronized boolean connect(Connection connection) { -// if (isConnected()) { -// disconnect(true); -// } -// this.connection = connection; -// this.canceled = false; -// return connect(); -// } -// -// @Override -// public boolean stopConnecting() { -// canceled = true; -// return true; -// } -// -// @Override -// public boolean connect() { -// sessionState = SessionState.CONNECTING; -// try { -// System.setProperty("http.nonProxyHosts", "code.google.com"); -// System.setProperty("socksNonProxyHosts", "code.google.com"); -// -// // clear previous values -// System.clearProperty("socksProxyHost"); -// System.clearProperty("socksProxyPort"); -// System.clearProperty("http.proxyHost"); -// System.clearProperty("http.proxyPort"); -// -// switch (connection.getProxyType()) { -// case SOCKS: -// System.setProperty("socksProxyHost", connection.getProxyHost()); -// System.setProperty("socksProxyPort", Integer.toString(connection.getProxyPort())); -// break; -// case HTTP: -// System.setProperty("http.proxyHost", connection.getProxyHost()); -// System.setProperty("http.proxyPort", Integer.toString(connection.getProxyPort())); -// Authenticator.setDefault(new MageAuthenticator(connection.getProxyUsername(), connection.getProxyPassword())); -// break; -// } -// InvokerLocator clientLocator = new InvokerLocator(connection.getURI()); -// -// Map metadata = new HashMap<>(); -// /* -// 5.8.3.1.1. Write timeouts -// The socket timeout facility offered by the JDK applies only to read operations on the socket. As of release 2.5.2, -// the socket and bisocket (and also sslsocket and sslbisocket) transports offer a write timeout facility. When a client -// or server is configured, in any of the usual ways, with the parameter org.jboss.remoting.transport.socket.SocketWrapper.WRITE_TIMEOUT -// (actual value "writeTimeout") set to a positive value (in milliseconds), all write operations will time out if they do -// not complete within the configured period. When a write operation times out, the socket upon which the write was invoked -// will be closed, which is likely to result in a java.net.SocketException. -// Note. A SocketException is considered to be a "retriable" exception, so, if the parameter "numberOfCallRetries" is set -// to a value greater than 1, an invocation interrupted by a write timeout can be retried. -// Note. The write timeout facility applies to writing of both invocations and responses. It applies to push callbacks as well. -// */ -// metadata.put(SocketWrapper.WRITE_TIMEOUT, "2000"); -// metadata.put("generalizeSocketException", "true"); -// server = (MageServer) TransporterClient.createTransporterClient(clientLocator.getLocatorURI(), MageServer.class, metadata); -// -// // http://docs.jboss.org/jbossremoting/docs/guide/2.5/html_single/#d0e1057 -// Map clientMetadata = new HashMap<>(); -// -// clientMetadata.put(SocketWrapper.WRITE_TIMEOUT, "2000"); -// /* generalizeSocketException -// * If set to false, a failed invocation will be retried in the case of -// * SocketExceptions. If set to true, a failed invocation will be retried in the case of -// * SocketExceptions and also any IOException -// * whose message matches the regular expression -// * ^.*(?:connection.*reset|connection.*closed|broken.*pipe).*$. -// * See also the "numberOfCallRetries" parameter, above. The default value is false.*/ -// clientMetadata.put("generalizeSocketException", "true"); -// -// /* A remoting server also has the capability to detect when a client is no longer available. -// * This is done by estabilishing a lease with the remoting clients that connect to a server. -// * On the client side, an org.jboss.remoting.LeasePinger periodically sends PING messages to -// * the server, and on the server side an org.jboss.remoting.Lease informs registered listeners -// * if the PING doesn't arrive withing the specified timeout period. */ -// clientMetadata.put(Client.ENABLE_LEASE, "true"); -// /* -// When the socket client invoker makes its first invocation, it will check to see if there is an available -// socket connection in its pool. Since is the first invocation, there will not be and will create a new socket -// connection and use it for making the invocation. Then when finished making invocation, will return the still -// active socket connection to the pool. As more client invocations are made, is possible for the number of -// socket connections to reach the maximum allowed (which is controlled by 'clientMaxPoolSize' property). At this -// point, when the next client invocation is made, it will wait up to some configured number of milliseconds, at -// which point it will throw an org.jboss.remoting.CannotConnectException. The number of milliseconds is given by -// the parameter MicroSocketClientInvoker.CONNECTION_WAIT (actual value "connectionWait"), with a default of -// 30000 milliseconds. Note that if more than one call retry is configured (see next paragraph), -// the CannotConnectException will be swallowed. -// Once the socket client invoker get an available socket connection from the pool, are not out of the woods yet. -// For example, a network problem could cause a java.net.SocketException. There is also a possibility that the socket -// connection, while still appearing to be valid, has "gone stale" while sitting in the pool. For example, a ServerThread -// on the other side of the connection could time out and close its socket. If the attempt to complete an invocation -// fails, then MicroSocketClientInvoker will make a number of attempts, according to the parameter "numberOfCallRetries", -// with a default value of 3. Once the configured number of retries has been exhausted, -// an org.jboss.remoting.InvocationFailureException will be thrown. -// */ -// clientMetadata.put("numberOfCallRetries", "1"); -// -// -// /** -// * I'll explain the meaning of "secondaryBindPort" and "secondaryConnectPort", and maybe that will help. -// * The Remoting bisocket transport creates two ServerSockets on the server. The "primary" ServerSocket is used to create -// * connections used for ordinary invocations, e.g., a request to create a JMS consumer, and the "secondary" ServerSocket -// * is used to create "control" connections for internal Remoting messages. The port for the primary ServerSocket is configured -// * by the "serverBindPort" parameter, and the port for the secondary ServerSocket is, by default, chosen randomly. -// * The "secondaryBindPort" parameter can be used to assign a specific port to the secondary ServerSocket. Now, if there is a -// * translating firewall between the client and server, the client should be given the value of the port that is translated -// * to the actual binding port of the secondary ServerSocket. -// * For example, your configuration will tell the secondary ServerSocket to bind to port 14000, and it will tell the client to -// * connect to port 14001. It assumes that there is a firewall which will translate 14001 to 14000. Apparently, that's not happening. -// */ -// // secondaryBindPort - the port to which the secondary server socket is to be bound. By default, an arbitrary port is selected. -// -// // secondaryConnectPort - the port clients are to use to connect to the secondary server socket. -// // By default, the value of secondaryBindPort is used. secondaryConnectPort is useful if the server is behind a translating firewall. -// -// // Indicated the max number of threads used within oneway thread pool. -// clientMetadata.put(Client.MAX_NUM_ONEWAY_THREADS, "10"); -// clientMetadata.put(Remoting.USE_CLIENT_CONNECTION_IDENTITY, "true"); -// callbackClient = new Client(clientLocator, "callback", clientMetadata); -// -// Map listenerMetadata = new HashMap<>(); -// if (debugMode) { -// // prevent client from disconnecting while debugging -// listenerMetadata.put(ConnectionValidator.VALIDATOR_PING_PERIOD, "1000000"); -// listenerMetadata.put(ConnectionValidator.VALIDATOR_PING_TIMEOUT, "900000"); -// } else { -// listenerMetadata.put(ConnectionValidator.VALIDATOR_PING_PERIOD, "15000"); -// listenerMetadata.put(ConnectionValidator.VALIDATOR_PING_TIMEOUT, "13000"); -// } -// callbackClient.connect(new ClientConnectionListener(), listenerMetadata); -// -// Map callbackMetadata = new HashMap<>(); -// callbackMetadata.put(Bisocket.IS_CALLBACK_SERVER, "true"); -// if (callbackHandler == null) { -// callbackHandler = new CallbackHandler(); -// } -// callbackClient.addListener(callbackHandler, callbackMetadata); -// -// Set callbackConnectors = callbackClient.getCallbackConnectors(callbackHandler); -// if (callbackConnectors.size() != 1) { -// logger.warn("There should be one callback Connector (number existing = " + callbackConnectors.size() + ")"); -// } -// -// logger.info("Trying to connect as " + (this.getUserName() == null ? "":this.getUserName()) + " to XMAGE server at " + connection.getHost() + ":" + connection.getPort()); -// callbackClient.invoke(null); -// -// this.sessionId = callbackClient.getSessionId(); -// boolean registerResult; -// if (connection.getPassword() == null) { -// UserDataView userDataView = new UserDataView(connection.getAvatarId(), -// connection.isShowAbilityPickerForced(), -// connection.allowRequestShowHandCards(), -// connection.confirmEmptyManaPool(), -// connection.getUserSkipPrioritySteps(), -// connection.getFlagName()); -// // for backward compatibility. don't remove twice call - first one does nothing but for version checking -// registerResult = server.registerClient(connection.getUsername(), sessionId, client.getVersion()); -// if (registerResult) { -// server.setUserData(connection.getUsername(), sessionId, userDataView); -// } -// } else { -// registerResult = server.registerAdmin(connection.getPassword(), sessionId, client.getVersion()); -// } -// if (registerResult) { -// sessionState = SessionState.CONNECTED; -// serverState = server.getServerState(); -// if (!connection.getUsername().equals("Admin")) { -// updateDatabase(connection.isForceDBComparison(), serverState); -// } -// logger.info("Connected as " + (this.getUserName() == null ? "":this.getUserName()) + " to MAGE server at " + connection.getHost() + ":" + connection.getPort()); -// client.connected(this.getUserName() == null ? "":this.getUserName() +"@" + connection.getHost() + ":" + connection.getPort() +" "); -// return true; -// } -// disconnect(false); -// // client.showMessage("Unable to connect to server."); -// } catch (MalformedURLException ex) { -// logger.fatal("", ex); -// client.showMessage("Unable to connect to server. " + ex.getMessage()); -// } catch (UndeclaredThrowableException ex) { -// String addMessage = ""; -// if (ex.getCause() instanceof InvocationFailureException) { -// InvocationFailureException exep = (InvocationFailureException) ex.getCause(); -// if (exep.getCause() instanceof IOException) { -// if (exep.getCause().getMessage().startsWith("Field hash null is not available on current")) { -// addMessage = "Probabaly the server version is not compatible to the client. "; -// } -// } -// } -// if (addMessage.isEmpty()) { -// logger.fatal("", ex); -// } -// client.showMessage("Unable to connect to server. " + addMessage + (ex.getMessage() != null ? ex.getMessage():"")); -// } catch (IOException ex) { -// logger.fatal("", ex); -// String addMessage = ""; -// if (ex.getMessage() != null && ex.getMessage().startsWith("Unable to perform invocation")) { -// addMessage = "Maybe the server version is not compatible. "; -// } -// client.showMessage("Unable to connect to server. " + addMessage + ex.getMessage() != null ? ex.getMessage():""); -// } catch (MageVersionException ex) { -// if (!canceled) { -// client.showMessage("Unable to connect to server. " + ex.getMessage()); -// } -// disconnect(false); -// } catch (CannotConnectException ex) { -// if (!canceled) { -// handleCannotConnectException(ex); -// } -// } catch (Throwable t) { -// logger.fatal("Unable to connect to server - ", t); -// if (!canceled) { -// disconnect(false); -// StringBuilder sb = new StringBuilder(); -// sb.append("Unable to connect to server.\n"); -// for (StackTraceElement element :t.getStackTrace()) { -// sb.append(element.toString()).append("\n"); -// } -// client.showMessage(sb.toString()); -// } -// } -// return false; -// } -// -// private void updateDatabase(boolean forceDBComparison, ServerState serverState) { -// long cardDBVersion = CardRepository.instance.getContentVersionFromDB(); -// if (forceDBComparison || serverState.getCardsContentVersion() > cardDBVersion) { -// List classNames = CardRepository.instance.getClassNames(); -// List cards = server.getMissingCardsData(classNames); -// CardRepository.instance.addCards(cards); -// CardRepository.instance.setContentVersion(serverState.getCardsContentVersion()); -// logger.info("Updating client cards DB - existing cards: " + classNames.size() + " new cards: " + cards.size() + -// " content versions - server: " + serverState.getCardsContentVersion() + " client: " + cardDBVersion); -// } -// -// long expansionDBVersion = ExpansionRepository.instance.getContentVersionFromDB(); -// if (forceDBComparison || serverState.getExpansionsContentVersion() > expansionDBVersion) { -// List setCodes = ExpansionRepository.instance.getSetCodes(); -// List expansions = server.getMissingExpansionData(setCodes); -// for (ExpansionInfo expansion : expansions) { -// ExpansionRepository.instance.add(expansion); -// } -// ExpansionRepository.instance.setContentVersion(serverState.getExpansionsContentVersion()); -// logger.info("Updating client expansions DB - existing sets: " + setCodes.size() + " new sets: " + expansions.size()+ -// " content versions - server: " + serverState.getExpansionsContentVersion() + " client: " + expansionDBVersion); -// } -// } -// -// private void handleCannotConnectException(CannotConnectException ex) { -// logger.warn("Cannot connect", ex); -// Throwable t = ex.getCause(); -// String message = ""; -// while (t != null) { -// if (t instanceof ConnectException) { -// message = "Server is likely offline." + message; -// break; -// } -// if (t instanceof SocketException) { -// message = "Check your internet connection." + message; -// break; -// } -// if (t instanceof SocketTimeoutException) { -// message = "Server is not responding." + message; -// break; -// } -// if (t.getCause() != null && logger.isDebugEnabled()) { -// message = "\n" + t.getCause().getMessage() + message; -// logger.debug(t.getCause().getMessage()); -// } -// -// t = t.getCause(); -// } -// client.showMessage("Unable to connect to server. " + message); -// if (logger.isTraceEnabled()) { -// logger.trace("StackTrace", t); -// } -// } -// -// /** -// * -// * @param askForReconnect - true = connection was lost because of error and ask the user if he want to try to reconnect -// */ -// @Override -// public synchronized void disconnect(boolean askForReconnect) { -// if (isConnected()) { -// logger.info("DISCONNECT (still connected)"); -// sessionState = SessionState.DISCONNECTING; -// } -// if (connection == null || sessionState == SessionState.DISCONNECTED) { -// return; -// } -// -// try { -// callbackClient.removeListener(callbackHandler); -// callbackClient.disconnect(); -// TransporterClient.destroyTransporterClient(server); -// } catch (Throwable ex) { -// logger.fatal("Error disconnecting ...", ex); -// } -// -// if (sessionState == SessionState.DISCONNECTING || sessionState == SessionState.CONNECTING) { -// sessionState = SessionState.DISCONNECTED; -// logger.info("Disconnected ... "); -// if (askForReconnect) { -// client.showError("Network error. You have been disconnected"); -// } -// client.disconnected(askForReconnect); // MageFrame with check to reconnect -// pingTime.clear(); -// } -// } -// -// @Override -// public synchronized void reconnect(Throwable throwable) { -// logger.info("RECONNECT - Connected: " + isConnected()); -// client.disconnected(true); -// } -// -// @Override -// public synchronized boolean sendFeedback(String title, String type, String message, String email) { -// if (isConnected()) { -// try { -// server.sendFeedbackMessage(sessionId, connection.getUsername(), title, type, message, email); -// return true; -// } catch (MageException e) { -// logger.error(e); -// } -// } -// return false; -// } -// -// class CallbackHandler implements InvokerCallbackHandler { -// @Override -// public void handleCallback(Callback callback) throws HandleCallbackException { -// //logger.info("callback handler"); -// client.processCallback((ClientCallback)callback.getCallbackObject()); -// } -// } -// -// class ClientConnectionListener implements ConnectionListener { -// // http://docs.jboss.org/jbossremoting/2.5.3.SP1/html/chapter-connection-failure.html -// -// @Override -// public void handleConnectionException(Throwable throwable, Client client) { -// logger.info("connection to server lost - " + throwable.getMessage()); -// throwable.printStackTrace(); -// -// reconnect(throwable); -// } -// } -// -// @Override -// public boolean isConnected() { -// if (callbackClient == null) { -// return false; -// } -// return callbackClient.isConnected(); -// } -// -// @Override -// public String[] getPlayerTypes() { -// return serverState.getPlayerTypes(); -// } -// -// @Override -// public List getGameTypes() { -// return serverState.getGameTypes(); -// } -// -// @Override -// public List getTournamentGameTypes() { -// return serverState.getTournamentGameTypes(); -// } -// -// @Override -// public String[] getDeckTypes() { -// return serverState.getDeckTypes(); -// } -// -// @Override -// public String[] getDraftCubes() { -// return serverState.getDraftCubes(); -// } -// -// -// @Override -// public List getTournamentTypes() { -// return serverState.getTournamentTypes(); -// } -// -// @Override -// public boolean isTestMode() { -// if (serverState != null) { -// return serverState.isTestMode(); -// } -// return false; -// } -// -// @Override -// public UUID getMainRoomId() { -// try { -// if (isConnected()) { -// return server.getMainRoomId(); -// } -// } catch (MageException ex) { -// handleMageException(ex); -// } -// return null; -// } -// -// @Override -// public UUID getRoomChatId(UUID roomId) { -// try { -// if (isConnected()) { -// return server.getRoomChatId(roomId); -// } -// } catch (MageException ex) { -// handleMageException(ex); -// } -// return null; -// } -// -// @Override -// public UUID getTableChatId(UUID tableId) { -// try { -// if (isConnected()) { -// return server.getTableChatId(tableId); -// } -// } catch (MageException ex) { -// handleMageException(ex); -// } -// return null; -// } -// -// @Override -// public UUID getGameChatId(UUID gameId) { -// try { -// if (isConnected()) { -// return server.getGameChatId(gameId); -// } -// } catch (MageException ex) { -// handleMageException(ex); -// } catch (Throwable t) { -// handleThrowable(t); -// } -// return null; -// } -// -// @Override -// public TableView getTable(UUID roomId, UUID tableId) { -// try { -// if (isConnected()) { -// return server.getTable(roomId, tableId); -// } -// } catch (MageException ex) { -// handleMageException(ex); -// } -// return null; -// } -// -// @Override -// public boolean watchTable(UUID roomId, UUID tableId) { -// try { -// if (isConnected()) { -// server.watchTable(sessionId, roomId, tableId); -// return true; -// } -// } catch (MageException ex) { -// handleMageException(ex); -// } catch (Throwable t) { -// handleThrowable(t); -// } -// return false; -// } -// -// @Override -// public boolean watchTournamentTable(UUID tableId) { -// try { -// if (isConnected()) { -// server.watchTournamentTable(sessionId, tableId); -// return true; -// } -// } catch (MageException ex) { -// handleMageException(ex); -// } catch (Throwable t) { -// handleThrowable(t); -// } -// return false; -// } -// -// @Override -// public boolean joinTable(UUID roomId, UUID tableId, String playerName, String playerType, int skill, DeckCardLists deckList, String password) { -// try { -// if (isConnected()) { -// return server.joinTable(sessionId, roomId, tableId, playerName, playerType, skill, deckList, password); -// } -// } catch (InvalidDeckException iex) { -// handleInvalidDeckException(iex); -// } catch (GameException ex) { -// handleGameException(ex); -// } catch (MageException ex) { -// handleMageException(ex); -// } catch (Throwable t) { -// handleThrowable(t); -// } -// return false; -// } -// -// @Override -// public boolean joinTournamentTable(UUID roomId, UUID tableId, String playerName, String playerType, int skill, DeckCardLists deckList, String password) { -// try { -// if (isConnected()) { -// return server.joinTournamentTable(sessionId, roomId, tableId, playerName, playerType, skill, deckList, password); -// } -// } catch (GameException ex) { -// handleGameException(ex); -// } catch (MageException ex) { -// handleMageException(ex); -// } catch (Throwable t) { -// handleThrowable(t); -// } -// return false; -// } -// -// @Override -// public Collection getTables(UUID roomId) throws MageRemoteException { -// try { -// if (isConnected()) { -// return server.getTables(roomId); -// } -// } catch (MageException ex) { -// handleMageException(ex); -// throw new MageRemoteException(); -// } catch (Throwable t) { -// handleThrowable(t); -// } -// return null; -// } -// -// @Override -// public Collection getFinishedMatches(UUID roomId) throws MageRemoteException { -// try { -// if (isConnected()) { -// return server.getFinishedMatches(roomId); -// } -// } catch (MageException ex) { -// handleMageException(ex); -// throw new MageRemoteException(); -// } catch (Throwable t) { -// handleThrowable(t); -// } -// return null; -// } -// -// @Override -// public Collection getRoomUsers(UUID roomId) throws MageRemoteException { -// try { -// if (isConnected()) { -// return server.getRoomUsers(roomId); -// } -// } catch (MageException ex) { -// handleMageException(ex); -// throw new MageRemoteException(); -// } catch (Throwable t) { -// handleThrowable(t); -// } -// return null; -// } -// -// @Override -// public TournamentView getTournament(UUID tournamentId) throws MageRemoteException { -// try { -// if (isConnected()) { -// return server.getTournament(tournamentId); -// } -// } catch (MageException ex) { -// handleMageException(ex); -// throw new MageRemoteException(); -// } catch (Throwable t) { -// handleThrowable(t); -// } -// return null; -// } -// -// @Override -// public UUID getTournamentChatId(UUID tournamentId) { -// try { -// if (isConnected()) { -// return server.getTournamentChatId(tournamentId); -// } -// } catch (MageException ex) { -// handleMageException(ex); -// } catch (Throwable t) { -// handleThrowable(t); -// } -// return null; -// } -// -// @Override -// public boolean sendPlayerUUID(UUID gameId, UUID data) { -// try { -// if (isConnected()) { -// server.sendPlayerUUID(gameId, sessionId, data); -// return true; -// } -// } catch (MageException ex) { -// handleMageException(ex); -// } catch (Throwable t) { -// handleThrowable(t); -// } -// return false; -// } -// -// @Override -// public boolean sendPlayerBoolean(UUID gameId, boolean data) { -// try { -// if (isConnected()) { -// server.sendPlayerBoolean(gameId, sessionId, data); -// return true; -// } -// } catch (MageException ex) { -// handleMageException(ex); -// } catch (Throwable t) { -// handleThrowable(t); -// } -// return false; -// } -// -// @Override -// public boolean sendPlayerInteger(UUID gameId, int data) { -// try { -// if (isConnected()) { -// server.sendPlayerInteger(gameId, sessionId, data); -// return true; -// } -// } catch (MageException ex) { -// handleMageException(ex); -// } catch (Throwable t) { -// handleThrowable(t); -// } -// return false; -// } -// -// @Override -// public boolean sendPlayerString(UUID gameId, String data) { -// try { -// if (isConnected()) { -// server.sendPlayerString(gameId, sessionId, data); -// return true; -// } -// } catch (MageException ex) { -// handleMageException(ex); -// } catch (Throwable t) { -// handleThrowable(t); -// } -// return false; -// } -// -// @Override -// public boolean sendPlayerManaType(UUID gameId, UUID playerId, ManaType data) { -// try { -// if (isConnected()) { -// server.sendPlayerManaType(gameId, playerId, sessionId, data); -// return true; -// } -// } catch (MageException ex) { -// handleMageException(ex); -// } catch (Throwable t) { -// handleThrowable(t); -// } -// return false; -// } -// -// @Override -// public DraftPickView sendCardPick(UUID draftId, UUID cardId, Set hiddenCards) { -// try { -// if (isConnected()) { -// return server.sendCardPick(draftId, sessionId, cardId, hiddenCards); -// } -// } catch (MageException ex) { -// handleMageException(ex); -// } catch (Throwable t) { -// handleThrowable(t); -// } -// return null; -// } -// -// @Override -// public DraftPickView sendCardMark(UUID draftId, UUID cardId) { -// try { -// if (isConnected()) { -// server.sendCardMark(draftId, sessionId, cardId); -// } -// } catch (MageException ex) { -// handleMageException(ex); -// } catch (Throwable t) { -// handleThrowable(t); -// } -// return null; -// } -// -// @Override -// public boolean joinChat(UUID chatId) { -// try { -// if (isConnected()) { -// server.joinChat(chatId, sessionId, connection.getUsername()); -// return true; -// } -// } catch (MageException ex) { -// handleMageException(ex); -// } catch (Throwable t) { -// handleThrowable(t); -// } -// return false; -// } -// -// @Override -// public boolean leaveChat(UUID chatId) { -//// lock.readLock().lock(); -// try { -// if (isConnected()) { -// server.leaveChat(chatId, sessionId); -// return true; -// } -// } catch (MageException ex) { -// handleMageException(ex); -// } catch (Throwable t) { -// handleThrowable(t); -//// } finally { -//// lock.readLock().unlock(); -// } -// return false; -// } -// -// @Override -// public boolean sendChatMessage(UUID chatId, String message) { -//// lock.readLock().lock(); -// try { -// if (isConnected()) { -// server.sendChatMessage(chatId, connection.getUsername(), message); -// return true; -// } -// } catch (MageException ex) { -// handleMageException(ex); -// } catch (Throwable t) { -// handleThrowable(t); -//// } finally { -//// lock.readLock().unlock(); -// } -// return false; -// } -// -// @Override -// public boolean sendBroadcastMessage(String message) { -// try { -// if (isConnected()) { -// server.sendBroadcastMessage(sessionId, message); -// return true; -// } -// } catch (MageException ex) { -// handleMageException(ex); -// } catch (Throwable t) { -// handleThrowable(t); -// } -// return false; -// } -// -// @Override -// public boolean joinGame(UUID gameId) { -// try { -// if (isConnected()) { -// server.joinGame(gameId, sessionId); -// return true; -// } -// } catch (MageException ex) { -// handleMageException(ex); -// } catch (Throwable t) { -// handleThrowable(t); -// } -// return false; -// } -// -// @Override -// public boolean joinDraft(UUID draftId) { -// try { -// if (isConnected()) { -// server.joinDraft(draftId, sessionId); -// return true; -// } -// } catch (MageException ex) { -// handleMageException(ex); -// } catch (Throwable t) { -// handleThrowable(t); -// } -// return false; -// } -// -// @Override -// public boolean joinTournament(UUID tournamentId) { -// try { -// if (isConnected()) { -// server.joinTournament(tournamentId, sessionId); -// return true; -// } -// } catch (MageException ex) { -// handleMageException(ex); -// } catch (Throwable t) { -// handleThrowable(t); -// } -// return false; -// } -// -// @Override -// public boolean watchGame(UUID gameId) { -// try { -// if (isConnected()) { -// server.watchGame(gameId, sessionId); -// return true; -// } -// } catch (MageException ex) { -// handleMageException(ex); -// } catch (Throwable t) { -// handleThrowable(t); -// } -// return false; -// } -// -// @Override -// public boolean replayGame(UUID gameId) { -// try { -// if (isConnected()) { -// server.replayGame(gameId, sessionId); -// return true; -// } -// } catch (MageException ex) { -// handleMageException(ex); -// } catch (Throwable t) { -// handleThrowable(t); -// } -// return false; -// } -// -// @Override -// public TableView createTable(UUID roomId, MatchOptions matchOptions) { -// try { -// if (isConnected()) { -// return server.createTable(sessionId, roomId, matchOptions); -// } -// } catch (MageException ex) { -// handleMageException(ex); -// } catch (Throwable t) { -// handleThrowable(t); -// } -// return null; -// } -// -// @Override -// public TableView createTournamentTable(UUID roomId, TournamentOptions tournamentOptions) { -// try { -// if (isConnected()) { -// return server.createTournamentTable(sessionId, roomId, tournamentOptions); -// } -// } catch (MageException ex) { -// handleMageException(ex); -// } catch (Throwable t) { -// handleThrowable(t); -// } -// return null; -// } -// -// @Override -// public boolean isTableOwner(UUID roomId, UUID tableId) { -// try { -// if (isConnected()) { -// return server.isTableOwner(sessionId, roomId, tableId); -// } -// } catch (MageException ex) { -// handleMageException(ex); -// } catch (Throwable t) { -// handleThrowable(t); -// } -// return false; -// } -// -// @Override -// public boolean removeTable(UUID roomId, UUID tableId) { -// try { -// if (isConnected()) { -// server.removeTable(sessionId, roomId, tableId); -// -// return true; -// } -// } catch (MageException ex) { -// handleMageException(ex); -// } catch (Throwable t) { -// handleThrowable(t); -// } -// return false; -// } -// -// /** -// * Remove table - called from admin console -// * @param tableId -// * @return -// */ -// @Override -// public boolean removeTable(UUID tableId) { -// try { -// if (isConnected()) { -// server.removeTable(sessionId, tableId); -// return true; -// } -// } catch (MageException ex) { -// handleMageException(ex); -// } catch (Throwable t) { -// handleThrowable(t); -// } -// return false; -// } -// -// @Override -// public boolean swapSeats(UUID roomId, UUID tableId, int seatNum1, int seatNum2) { -// try { -// if (isConnected()) { -// server.swapSeats(sessionId, roomId, tableId, seatNum1, seatNum2); -// return true; -// } -// } catch (MageException ex) { -// handleMageException(ex); -// } catch (Throwable t) { -// handleThrowable(t); -// } -// return false; -// } -// -// @Override -// public boolean leaveTable(UUID roomId, UUID tableId) { -// try { -// if (isConnected() && server.leaveTable(sessionId, roomId, tableId)) { -// return true; -// } -// } catch (MageException ex) { -// handleMageException(ex); -// } catch (Throwable t) { -// handleThrowable(t); -// } -// return false; -// } -// -// @Override -// public boolean startMatch(UUID roomId, UUID tableId) { -// try { -// if (isConnected()) { -// return (server.startMatch(sessionId, roomId, tableId)); -// } -// } catch (MageException ex) { -// handleMageException(ex); -// } -// return false; -// } -// -// @Override -// public boolean startTournament(UUID roomId, UUID tableId) { -// try { -// if (isConnected() && server.startTournament(sessionId, roomId, tableId)) { -// return true; -// } -// } catch (MageException ex) { -// handleMageException(ex); -// } catch (Throwable t) { -// handleThrowable(t); -// } -// return false; -// } -// -//// @Override -//// public boolean startChallenge(UUID roomId, UUID tableId, UUID challengeId) { -//// try { -//// if (isConnected()) { -//// server.startChallenge(sessionId, roomId, tableId, challengeId); -//// return true; -//// } -//// } catch (MageException ex) { -//// handleMageException(ex); -//// } catch (Throwable t) { -//// handleThrowable(t); -//// } -//// return false; -//// } -// -// @Override -// public boolean submitDeck(UUID tableId, DeckCardLists deck) { -// try { -// if (isConnected()) { -// return server.submitDeck(sessionId, tableId, deck); -// } -// } catch (GameException ex) { -// handleGameException(ex); -// } catch (MageException ex) { -// handleMageException(ex); -// } catch (Throwable t) { -// handleThrowable(t); -// } -// return false; -// } -// -// @Override -// public boolean updateDeck(UUID tableId, DeckCardLists deck) { -// try { -// if (isConnected()) { -// server.updateDeck(sessionId, tableId, deck); -// return true; -// } -// } catch (GameException ex) { -// handleGameException(ex); -// } catch (MageException ex) { -// handleMageException(ex); -// } catch (Throwable t) { -// handleThrowable(t); -// } -// return false; -// } -// -// @Override -// public boolean quitMatch(UUID gameId) { -// try { -// if (isConnected()) { -// server.quitMatch(gameId, sessionId); -// return true; -// } -// } catch (MageException ex) { -// handleMageException(ex); -// } catch (Throwable t) { -// handleThrowable(t); -// } -// return false; -// } -// -// @Override -// public boolean quitTournament(UUID tournamentId) { -// try { -// if (isConnected()) { -// server.quitTournament(tournamentId, sessionId); -// return true; -// } -// } catch (MageException ex) { -// handleMageException(ex); -// } catch (Throwable t) { -// handleThrowable(t); -// } -// return false; -// } -// -// @Override -// public boolean quitDraft(UUID draftId) { -// try { -// if (isConnected()) { -// server.quitDraft(draftId, sessionId); -// return true; -// } -// } catch (MageException ex) { -// handleMageException(ex); -// } -// return false; -// } -// -// @Override -// public boolean sendPlayerAction(PlayerAction passPriorityAction, UUID gameId, Object data) { -// try { -// if (isConnected()) { -// server.sendPlayerAction(passPriorityAction, gameId, sessionId, data); -// return true; -// } -// } catch (MageException ex) { -// handleMageException(ex); -// } catch (Throwable t) { -// handleThrowable(t); -// } -// return false; -// } -// -// @Override -// public boolean stopWatching(UUID gameId) { -// try { -// if (isConnected()) { -// server.stopWatching(gameId, sessionId); -// return true; -// } -// } catch (MageException ex) { -// handleMageException(ex); -// } catch (Throwable t) { -// handleThrowable(t); -// } -// return false; -// } -// -// @Override -// public boolean startReplay(UUID gameId) { -// try { -// if (isConnected()) { -// server.startReplay(gameId, sessionId); -// return true; -// } -// } catch (MageException ex) { -// handleMageException(ex); -// } catch (Throwable t) { -// handleThrowable(t); -// } -// return false; -// } -// -// @Override -// public boolean stopReplay(UUID gameId) { -// try { -// if (isConnected()) { -// server.stopReplay(gameId, sessionId); -// return true; -// } -// } catch (MageException ex) { -// handleMageException(ex); -// } catch (Throwable t) { -// handleThrowable(t); -// } -// return false; -// } -// -// @Override -// public boolean nextPlay(UUID gameId) { -// try { -// if (isConnected()) { -// server.nextPlay(gameId, sessionId); -// return true; -// } -// } catch (MageException ex) { -// handleMageException(ex); -// } catch (Throwable t) { -// handleThrowable(t); -// } -// return false; -// } -// -// @Override -// public boolean previousPlay(UUID gameId) { -// try { -// if (isConnected()) { -// server.previousPlay(gameId, sessionId); -// return true; -// } -// } catch (MageException ex) { -// handleMageException(ex); -// } catch (Throwable t) { -// handleThrowable(t); -// } -// return false; -// } -// -// @Override -// public boolean skipForward(UUID gameId, int moves) { -// try { -// if (isConnected()) { -// server.skipForward(gameId, sessionId, moves); -// return true; -// } -// } catch (MageException ex) { -// handleMageException(ex); -// } catch (Throwable t) { -// handleThrowable(t); -// } -// return false; -// } -// -// @Override -// public boolean cheat(UUID gameId, UUID playerId, DeckCardLists deckList) { -// try { -// if (isConnected()) { -// server.cheat(gameId, sessionId, playerId, deckList); -// return true; -// } -// } catch (MageException ex) { -// handleMageException(ex); -// } catch (Throwable t) { -// handleThrowable(t); -// } -// return false; -// } -// -// @Override -// public List getUsers() { -// try { -// if (isConnected()) { -// return server.getUsers(sessionId); -// } -// } catch (MageException ex) { -// handleMageException(ex); -// } catch (Throwable t) { -// handleThrowable(t); -// } -// return null; -// } -// -// @Override -// public List getServerMessages() { -// try { -// if (isConnected()) { -// return (List) CompressUtil.decompress(server.getServerMessagesCompressed(sessionId)); -// } -// } catch (MageException ex) { -// handleMageException(ex); -// } catch (Throwable t) { -// handleThrowable(t); -// } -// return null; -// } -// -// @Override -// public boolean disconnectUser(String userSessionId) { -// try { -// if (isConnected()) { -// server.disconnectUser(sessionId, userSessionId); -// return true; -// } -// } catch (MageException ex) { -// handleMageException(ex); -// } catch (Throwable t) { -// handleThrowable(t); -// } -// return false; -// } -// -// @Override -// public boolean endUserSession(String userSessionId) { -// try { -// if (isConnected()) { -// server.endUserSession(sessionId, userSessionId); -// return true; -// } -// } catch (MageException ex) { -// handleMageException(ex); -// } catch (Throwable t) { -// handleThrowable(t); -// } -// return false; -// } -// -// private void handleThrowable(Throwable t) { -// logger.fatal("Communication error", t); -// // Probably this can cause hanging the client under certain circumstances as the disconnect method is synchronized -// // so check if it's needed -// // disconnect(true); -// } -// -// private void handleMageException(MageException ex) { -// logger.fatal("Server error", ex); -// client.showError(ex.getMessage()); -// } -// -// private void handleInvalidDeckException(InvalidDeckException iex) { -// logger.warn(iex.getMessage() + "\n" + iex.getInvalid()); -// client.showError(iex.getMessage() + "\n" + iex.getInvalid()); -// } -// -// private void handleGameException(GameException ex) { -// logger.warn(ex.getMessage()); -// client.showError(ex.getMessage()); -// } -// -// -// @Override -// public String getUserName() { -// return connection.getUsername(); -// } -// -// @Override -// public boolean updatePreferencesForServer(int avatarId, boolean showAbilityPickerForced, boolean allowRequestShowHandCards, boolean confirmEmptyManaPool, UserSkipPrioritySteps userSkipPrioritySteps, String flagName) { -// try { -// if (isConnected()) { -// UserDataView userDataView = new UserDataView(avatarId, showAbilityPickerForced, allowRequestShowHandCards, confirmEmptyManaPool, userSkipPrioritySteps, flagName); -// server.setUserData(connection.getUsername(), sessionId, userDataView); -// } -// return true; -// } catch (MageException ex) { -// handleMageException(ex); -// } catch (Throwable t) { -// handleThrowable(t); -// } -// return false; -// } -// -// @Override -// public boolean ping() { -// try { -// if (isConnected()) { -// long startTime = System.nanoTime(); -// if (!server.ping(sessionId, pingInfo)) { -// logger.error("Ping failed: " + this.getUserName() + " Session: " + sessionId + " to MAGE server at " + connection.getHost() +":" + connection.getPort()); -// throw new MageException("Ping failed"); -// } -// pingTime.add(System.nanoTime() - startTime); -// long milliSeconds = TimeUnit.MILLISECONDS.convert(pingTime.getLast(), TimeUnit.NANOSECONDS); -// String lastPing = milliSeconds > 0 ? milliSeconds+"ms" : "<1ms"; -// if (pingTime.size() > PING_CYCLES) { -// pingTime.poll(); -// } -// long sum = 0; -// for (Long time :pingTime) { -// sum += time; -// } -// milliSeconds = TimeUnit.MILLISECONDS.convert(sum / pingTime.size(), TimeUnit.NANOSECONDS); -// pingInfo = lastPing + " (Av: " + (milliSeconds > 0 ? milliSeconds + "ms":"<1ms")+")"; -// } -// return true; -// } catch (MageException ex) { -// handleMageException(ex); -// disconnect(true); -// } catch (Throwable t) { -// handleThrowable(t); -// } -// return false; -// } -// -// @Override -// public String getVersionInfo() { -// if (serverState != null) { -// return serverState.getVersion().toString(); -// } else { -// return ""; -// } -// } -// -//} -// -// -//class MageAuthenticator extends Authenticator { -// -// private final String username; -// private final String password; -// -// public MageAuthenticator(String username, String password) { -// this.username = username; -// this.password = password; -// } -// -// @Override -// public PasswordAuthentication getPasswordAuthentication () { -// return new PasswordAuthentication (username, password.toCharArray()); -// } -//} diff --git a/Mage.Server/config/config.xml b/Mage.Server/config/config.xml index b6a3eb38f8b..e2b72b90203 100644 --- a/Mage.Server/config/config.xml +++ b/Mage.Server/config/config.xml @@ -35,7 +35,7 @@ userNamePattern="[^a-z0-9_]" maxAiOpponents="15" saveGameActivated="false" - useSSL="true" + useSSL="true" /> diff --git a/Mage.Server/pom.xml b/Mage.Server/pom.xml index e31288ef6d2..0a27e589d6a 100644 --- a/Mage.Server/pom.xml +++ b/Mage.Server/pom.xml @@ -28,20 +28,6 @@ ${project.groupId} mage-common ${mage-version} - - - org.jboss - jboss-common-core - - - org.jboss.remoting - jboss-remoting - - - jboss - jboss-serialization - - ${project.groupId} diff --git a/Mage.Server/src/main/java/mage/server/ChatManager.java b/Mage.Server/src/main/java/mage/server/ChatManager.java index fd6e29c9832..7a929624672 100644 --- a/Mage.Server/src/main/java/mage/server/ChatManager.java +++ b/Mage.Server/src/main/java/mage/server/ChatManager.java @@ -111,7 +111,6 @@ public class ChatManager { ChatSession chatSession = chatSessions.get(chatId); if (chatSession != null) { if (message.startsWith("\\") || message.startsWith("/")) { -// User user = UserManager.getInstance().findUser(userName); if (chatSession.performUserCommand(user, message, chatId)) { return; } @@ -140,14 +139,11 @@ public class ChatManager { * @param color */ public void broadcast(User user, String message, MessageColor color) { -// User user = UserManager.getInstance().getUser(userId); -// if (user != null) { for (ChatSession chat: chatSessions.values()) { if (chat.hasUser(user.getId())) { chat.broadcast(user.getName(), message, color); } } -// } } public void sendReconnectMessage(UUID userId) { diff --git a/Mage.Server/src/main/java/mage/server/ChatSession.java b/Mage.Server/src/main/java/mage/server/ChatSession.java index ef3a978aa0e..74e9951a2b7 100644 --- a/Mage.Server/src/main/java/mage/server/ChatSession.java +++ b/Mage.Server/src/main/java/mage/server/ChatSession.java @@ -159,7 +159,6 @@ public class ChatSession { User chatUser = UserManager.getInstance().getUser(userId); if (chatUser != null) { ServerMain.getInstance().sendChatMessage(chatUser.getSessionId(), chatId, new ChatMessage(userName, message, time, color, messageType, soundToPlay)); -// user.fireCallback(new ClientCallback("chatMessage", chatId, new ChatMessage(username, msg, time, color, messageType, soundToPlay))); } else { logger.error("User not found but connected to chat - userId: " + userId + " chatId: " + chatId); diff --git a/Mage.Server/src/main/java/mage/server/Session.java b/Mage.Server/src/main/java/mage/server/Session.java index 32046ac48f1..7daed680633 100644 --- a/Mage.Server/src/main/java/mage/server/Session.java +++ b/Mage.Server/src/main/java/mage/server/Session.java @@ -64,24 +64,17 @@ public class Session { private final LinkedList pingTime = new LinkedList<>(); private String pingInfo = ""; -// private final AsynchInvokerCallbackHandler callbackHandler; private final ReentrantLock lock; public Session(String sessionId) { this.sessionId = sessionId; -// this.callbackHandler = (AsynchInvokerCallbackHandler) callbackHandler; this.isAdmin = false; this.timeConnected = new Date(); this.lock = new ReentrantLock(); } public String registerUser(Connection connection) { -// String returnMessage = registerUserHandling(userName); -// if (returnMessage != null) { -// sendErrorMessageToClient(returnMessage); -// } -// return returnMessage; pingTaskExecutor.scheduleAtFixedRate(new Runnable() { @Override public void run() { @@ -117,7 +110,6 @@ public class Session { if (user == null) { // user already exists user = UserManager.getInstance().findUser(userName); if (user.getHost().equals(host)) { -// user.updateLastActivity(null); // minimizes possible expiration this.userId = user.getId(); if (user.getSessionId().isEmpty()) { logger.info("Reconnecting session for " + userName); @@ -164,7 +156,6 @@ public class Session { } public boolean setUserData(User user, UserDataView userDataView) { -// User user = UserManager.getInstance().findUser(userName); if (user != null) { UserData userData = user.getUserData(); if (user.getUserData() == null || user.getUserData().getGroupId() == UserGroup.DEFAULT.getGroupId()) { @@ -281,20 +272,6 @@ public class Session { } -// public void fireCallback(final ClientCallback call) { -// try { -// call.setMessageId(messageId++); -// callbackHandler.handleCallbackOneway(new Callback(call)); -// } catch (HandleCallbackException ex) { -// User user = UserManager.getInstance().getUser(userId); -// logger.warn("SESSION CALLBACK EXCEPTION - " + (user != null ? user.getName():"") + " userId " + userId); -// logger.warn(" - method: " + call.getMethod()); -// logger.warn(" - cause: " + getBasicCause(ex).toString()); -// logger.trace("Stack trace:", ex); -// userLostConnection(); -// } -// } - public UUID getUserId() { return userId; } @@ -315,13 +292,6 @@ public class Session { this.host = hostAddress; } -// void sendErrorMessageToClient(String message) { -// List messageData = new LinkedList<>(); -// messageData.add("Error while connecting to server"); -// messageData.add(message); -// fireCallback(new ClientCallback("showUserMessage", null, messageData)); -// } - public static Throwable getBasicCause(Throwable cause) { Throwable t = cause; while (t.getCause() != null) { diff --git a/Mage.Server/src/main/java/mage/server/SessionManager.java b/Mage.Server/src/main/java/mage/server/SessionManager.java index ce6f5d174f8..91fbcab25f1 100644 --- a/Mage.Server/src/main/java/mage/server/SessionManager.java +++ b/Mage.Server/src/main/java/mage/server/SessionManager.java @@ -66,17 +66,10 @@ public class SessionManager { return session; } -// public void createSession(String sessionId) { -// Session session = new Session(sessionId); -// sessions.put(sessionId, session); -// } - public boolean registerUser(String sessionId, Connection connection, String host) { Session session = new Session(sessionId); sessions.put(sessionId, session); session.setHost(host); -// Session session = sessions.get(sessionId); -// if (session != null) { String returnMessage = session.registerUser(connection); if (returnMessage == null) { LogServiceImpl.instance.log(LogKeys.KEY_USER_CONNECTED, connection.getUsername(), session.getHost(), sessionId); @@ -89,11 +82,6 @@ public class SessionManager { } logger.debug(connection.getUsername() + " not registered: " + returnMessage); ServerMain.getInstance().informClient(sessionId, "Connection Error", returnMessage, MessageType.ERROR); -// Server.informClient(sessionId, returnMessage, MessageType.ERROR); - -// } else { -// logger.error(userName + " tried to join with no sessionId"); -// } return false; } @@ -216,14 +204,6 @@ public class SessionManager { return null; } -// public boolean extendUserSession(String sessionId, String pingInfo) { -// Session session = sessions.get(sessionId); -// if (session != null) { -// return UserManager.getInstance().extendUserSession(session.getUserId(), pingInfo); -// } -// return false; -// } - void recordPingTime(String sessionId, long milliSeconds) { Session session = sessions.get(sessionId); if (session != null) { diff --git a/Mage.Server/src/main/java/mage/server/User.java b/Mage.Server/src/main/java/mage/server/User.java index 7c03c52931b..d58c3e443ca 100644 --- a/Mage.Server/src/main/java/mage/server/User.java +++ b/Mage.Server/src/main/java/mage/server/User.java @@ -94,7 +94,6 @@ public class User { private String info = ""; private String pingInfo = ""; private Date disconnectionTime; -// private Date lastActivity; private UserState userState; private UserData userData; @@ -105,7 +104,6 @@ public class User { this.userState = UserState.Created; this.connectionTime = new Date(); -// this.lastActivity = new Date(); this.tables = new ConcurrentHashMap<>(); this.gameSessions = new ConcurrentHashMap<>(); @@ -188,23 +186,11 @@ public class User { return connectionTime; } -// public void fireCallback(final ClientCallback call) { -// if (isConnected()) { -// Session session = SessionManager.getInstance().getSession(sessionId); -// if (session != null) { -// -// session.fireCallback(call); -// } -// } -// } - public void joinedTable(final UUID roomId, final UUID tableId, final UUID chatId, boolean owner, boolean tournament) { -// fireCallback(new ClientCallback("joinedTable", tableId, new TableClientMessage(roomId, tableId, isTournament))); ServerMain.getInstance().joinedTable(sessionId, roomId, tableId, chatId, owner, tournament); } public void gameStarted(final UUID gameId, final UUID playerId) { -// fireCallback(new ClientCallback("startGame", gameId, new TableClientMessage(gameId, playerId))); ServerMain.getInstance().gameStarted(sessionId, gameId, playerId); } @@ -352,50 +338,25 @@ public class User { } public void sendPlayerUUID(final UUID gameId, final UUID data) { -// lastActivity = new Date(); GameManager.getInstance().sendPlayerUUID(gameId, userId, data); } public void sendPlayerString(final UUID gameId, final String data) { -// lastActivity = new Date(); GameManager.getInstance().sendPlayerString(gameId, userId, data); } public void sendPlayerManaType(final UUID gameId, final UUID playerId, final ManaType data) { -// lastActivity = new Date(); GameManager.getInstance().sendPlayerManaType(gameId, playerId, userId, data); } public void sendPlayerBoolean(final UUID gameId, final Boolean data) { -// lastActivity = new Date(); GameManager.getInstance().sendPlayerBoolean(gameId, userId, data); } public void sendPlayerInteger(final UUID gameId, final Integer data) { -// lastActivity = new Date(); GameManager.getInstance().sendPlayerInteger(gameId, userId, data); } -// public void updateLastActivity(String pingInfo) { -// if (pingInfo != null) { -// this.pingInfo = pingInfo; -// } -// lastActivity = new Date(); -// if (userState == UserState.Disconnected) { // this can happen if user reconnects very fast after disconnect -// userState = UserState.Reconnected; -// } -// } - -// public boolean isExpired(Date expired) { -// if (lastActivity.before(expired)) { -// logger.trace(userName + " is expired!"); -// userState = UserState.Expired; -// return true; -// } -// logger.trace(new StringBuilder("isExpired: User ").append(userName).append(" lastActivity: ").append(lastActivity).append(" expired: ").append(expired).toString()); -// return false; /*userState == UserState.Disconnected && */ -// } - private void reconnect() { for (Entry entry : tables.entrySet()) { Table t = entry.getValue(); @@ -635,12 +596,4 @@ public class User { return userState; } -// public String getPingInfo() { -// if (isConnected()) { -// return pingInfo; -// } else { -// return " (discon. "+ getDisconnectDuration() + ")"; -// } -// } - } diff --git a/Mage.Server/src/main/java/mage/server/UserManager.java b/Mage.Server/src/main/java/mage/server/UserManager.java index 0a5363272ff..696a7ca01a0 100644 --- a/Mage.Server/src/main/java/mage/server/UserManager.java +++ b/Mage.Server/src/main/java/mage/server/UserManager.java @@ -27,18 +27,13 @@ */ package mage.server; -import mage.remote.DisconnectReason; -import java.util.ArrayList; -import java.util.Calendar; import java.util.Collection; -import java.util.List; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; -import mage.server.User.UserState; +import mage.remote.DisconnectReason; import mage.server.util.ThreadExecutor; import org.apache.log4j.Logger; @@ -65,14 +60,6 @@ public class UserManager { return INSTANCE; } -// private UserManager() { -// expireExecutor.scheduleAtFixedRate(new Runnable() { -// @Override -// public void run() { -// checkExpired(); -// } -// }, 60, 60, TimeUnit.SECONDS); -// } public User createUser(String userName, String host) { if (findUser(userName) != null) { @@ -160,45 +147,16 @@ public class UserManager { } } -// public boolean extendUserSession(UUID userId, String pingInfo) { -// if (userId != null) { -// User user = users.get(userId); -// if (user != null) { -// user.updateLastActivity(pingInfo); -// return true; -// } -// } -// return false; -// } - - /** - * Is the connection lost for more than 3 minutes, the user will be removed (within 3 minutes the user can reconnect) - */ -// private void checkExpired() { -// Calendar calendar = Calendar.getInstance(); -// calendar.add(Calendar.MINUTE, -3); -// List usersToCheck = new ArrayList<>(); -// usersToCheck.addAll(users.values()); -// for (User user : usersToCheck) { -// if (!user.getUserState().equals(UserState.Expired) && user.isExpired(calendar.getTime())) { -// removeUser(user.getId(), DisconnectReason.SessionExpired); -// } -// } -// } - public void handleException(Exception ex) { if (ex != null) { logger.fatal("User manager exception " + (ex.getMessage() == null ? "null":ex.getMessage())); if (ex.getCause() != null) { logger.debug("- Cause: " + (ex.getCause().getMessage() == null ? "null":ex.getCause().getMessage())); } - ex.printStackTrace(); + logger.error("UserManager error:", ex); }else { logger.fatal("User manager exception - null"); } } - void recordPingTime(UUID userId, long milliSeconds) { - throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. - } } diff --git a/Mage.Server/src/main/java/mage/server/game/GameSessionPlayer.java b/Mage.Server/src/main/java/mage/server/game/GameSessionPlayer.java index f81e1a61265..661971a96ba 100644 --- a/Mage.Server/src/main/java/mage/server/game/GameSessionPlayer.java +++ b/Mage.Server/src/main/java/mage/server/game/GameSessionPlayer.java @@ -80,7 +80,6 @@ public class GameSessionPlayer extends GameSessionWatcher { if (!killed) { User user = UserManager.getInstance().getUser(userId); if (user != null) { -// user.fireCallback(new ClientCallback("gameAsk", game.getId(), new GameClientMessage(getGameView(), question))); user.gameAsk(game.getId(), getGameView(), question, options); } } @@ -90,7 +89,6 @@ public class GameSessionPlayer extends GameSessionWatcher { if (!killed) { User user = UserManager.getInstance().getUser(userId); if (user != null) { -// user.fireCallback(new ClientCallback("gameTarget", game.getId(), new GameClientMessage(getGameView(), question, cardView, targets, required, options))); user.gameTarget(game.getId(), getGameView(), question, cardView, targets, required, options); } } @@ -100,7 +98,6 @@ public class GameSessionPlayer extends GameSessionWatcher { if (!killed) { User user = UserManager.getInstance().getUser(userId); if (user != null) { -// user.fireCallback(new ClientCallback("gameSelect", game.getId(), new GameClientMessage(getGameView(), message, options))); user.gameSelect(game.getId(), getGameView(), message, options); } } @@ -110,7 +107,6 @@ public class GameSessionPlayer extends GameSessionWatcher { if (!killed) { User user = UserManager.getInstance().getUser(userId); if (user != null) { -// user.fireCallback(new ClientCallback("gameChooseAbility", game.getId(), abilities)); user.gameChooseAbility(game.getId(), abilities); } } @@ -120,7 +116,6 @@ public class GameSessionPlayer extends GameSessionWatcher { if (!killed) { User user = UserManager.getInstance().getUser(userId); if (user != null) { -// user.fireCallback(new ClientCallback("gameChoosePile", game.getId(), new GameClientMessage(message, pile1, pile2))); user.gameChoosePile(game.getId(), message, pile1, pile2); } } @@ -130,7 +125,6 @@ public class GameSessionPlayer extends GameSessionWatcher { if (!killed) { User user = UserManager.getInstance().getUser(userId); if (user != null) { -// user.fireCallback(new ClientCallback("gameChooseChoice", game.getId(), new GameClientMessage(choice))); user.gameChooseChoice(game.getId(), choice); } } @@ -140,7 +134,6 @@ public class GameSessionPlayer extends GameSessionWatcher { if (!killed) { User user = UserManager.getInstance().getUser(userId); if (user != null) { -// user.fireCallback(new ClientCallback("gamePlayMana", game.getId(), new GameClientMessage(getGameView(), message))); user.gamePlayMana(game.getId(), getGameView(), message, options); } } @@ -150,7 +143,6 @@ public class GameSessionPlayer extends GameSessionWatcher { if (!killed) { User user = UserManager.getInstance().getUser(userId); if (user != null) { -// user.fireCallback(new ClientCallback("gamePlayXMana", game.getId(), new GameClientMessage(getGameView(), message))); user.gamePlayXMana(game.getId(), getGameView(), message); } } @@ -160,7 +152,6 @@ public class GameSessionPlayer extends GameSessionWatcher { if (!killed) { User user = UserManager.getInstance().getUser(userId); if (user != null) { -// user.fireCallback(new ClientCallback("gameSelectAmount", game.getId(), new GameClientMessage(message, min, max))); user.gameSelectAmount(game.getId(), message, min, max); } } @@ -170,7 +161,6 @@ public class GameSessionPlayer extends GameSessionWatcher { if (!killed) { User user = UserManager.getInstance().getUser(userId); if (user != null) { -// user.fireCallback(new ClientCallback("endGameInfo", game.getId(), getGameEndView(playerId, table))); user.endGameInfo(game.getId(), getGameEndView(playerId, table)); } } @@ -198,7 +188,6 @@ public class GameSessionPlayer extends GameSessionWatcher { userRequestMessage.setGameId(game.getId()); userRequestMessage.setButton1("Accept", PlayerAction.ADD_PERMISSION_TO_ROLLBACK_TURN); userRequestMessage.setButton2("Deny", PlayerAction.DENY_PERMISSON_TO_ROLLBACK_TURN); -// requestedUser.fireCallback(new ClientCallback("userRequestDialog", game.getId(), userRequestMessage)); requestedUser.userRequestDialog(game.getId(), userRequestMessage); } } @@ -217,7 +206,6 @@ public class GameSessionPlayer extends GameSessionWatcher { userRequestMessage.setGameId(game.getId()); userRequestMessage.setButton1("Accept", PlayerAction.ADD_PERMISSION_TO_SEE_HAND_CARDS); userRequestMessage.setButton2("Reject", null); -// user.fireCallback(new ClientCallback("userRequestDialog", game.getId(), userRequestMessage)); user.userRequestDialog(game.getId(), userRequestMessage); } } diff --git a/Mage.Server/src/main/java/mage/server/game/GameSessionWatcher.java b/Mage.Server/src/main/java/mage/server/game/GameSessionWatcher.java index cca215fe4be..c7f9aaf339b 100644 --- a/Mage.Server/src/main/java/mage/server/game/GameSessionWatcher.java +++ b/Mage.Server/src/main/java/mage/server/game/GameSessionWatcher.java @@ -65,7 +65,6 @@ public class GameSessionWatcher { if (!killed) { User user = UserManager.getInstance().getUser(userId); if (user != null) { -// user.fireCallback(new ClientCallback("gameInit", game.getId(), getGameView())); user.initGame(game.getId(), getGameView()); return true; }