This commit is contained in:
betasteward 2015-08-19 11:05:33 -04:00
parent b4edc1bda1
commit 129b6d1e82
38 changed files with 33 additions and 2654 deletions

View file

@ -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<UUID, DraftPanel> 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

View file

@ -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();

View file

@ -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

View file

@ -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();

View file

@ -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;

View file

@ -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;

View file

@ -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);
}
}

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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();

View file

@ -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;

View file

@ -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.*;

View file

@ -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<String, Serializable> 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);

View file

@ -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;

View file

@ -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;

View file

@ -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<String> messageData = (List<String>) 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("<br/>Turn mousewheel up (ALT-e) - enlarge image of card the mousepointer hovers over")
// .append("<br/>Turn mousewheel down (ALT-s) - enlarge original/alternate image of card the mousepointer hovers over")
// .append("<br/><b>F2</b> - Confirm \"Ok\", \"Yes\" or \"Done\" button")
// .append("<br/><b>F4</b> - Skip current turn but stop on declare attackers/blockers and something on the stack")
// .append("<br/><b>F5</b> - Skip to next end step but stop on declare attackers/blockers and something on the stack")
// .append("<br/><b>F7</b> - Skip to next main phase but stop on declare attackers/blockers and something on the stack")
// .append("<br/><b>F9</b> - Skip everything until your next turn")
// .append("<br/><b>F3</b> - 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("<br/>Download icons and symbols by using the \"Symbols\" menu to the top right.")
// .append("<br/>\\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());
// }
//}

View file

@ -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;
/**
*

View file

@ -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<Void, RoomView> {
}
//class UpdatePlayersTask extends SwingWorker<Void, Collection<RoomUsersView>> {
//
// 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<Collection<RoomUsersView>> 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<Void, Collection<MatchView>> {
//
// 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<MatchView> matches = client.getFinishedMatches(roomId);
// if (matches != null) {
// this.publish(matches);
// }
// Thread.sleep(10000);
// }
// return null;
// }
//
// @Override
// protected void process(List<Collection<MatchView>> 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;

View file

@ -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;
/**
*

View file

@ -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;

View file

@ -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;

View file

@ -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) {

View file

@ -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);
//
//}

View file

@ -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<ExpansionInfo> getMissingExpansionData(List<String> codes);
// List<CardInfo> getMissingCardsData(List<String> 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<RoomUsersView> getRoomUsers(UUID roomId) throws MageException;
// List<MatchView> 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<TableView> 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<UUID> 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<UserView> 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;
//}

View file

@ -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;

View file

@ -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 {
//
//}

File diff suppressed because it is too large Load diff

View file

@ -35,7 +35,7 @@
userNamePattern="[^a-z0-9_]"
maxAiOpponents="15"
saveGameActivated="false"
useSSL="true"
useSSL="true"
/>
<playerTypes>
<playerType name="Human" jar="mage-player-human.jar" className="mage.player.human.HumanPlayer"/>

View file

@ -28,20 +28,6 @@
<groupId>${project.groupId}</groupId>
<artifactId>mage-common</artifactId>
<version>${mage-version}</version>
<exclusions>
<exclusion>
<groupId>org.jboss</groupId>
<artifactId>jboss-common-core</artifactId>
</exclusion>
<exclusion>
<groupId>org.jboss.remoting</groupId>
<artifactId>jboss-remoting</artifactId>
</exclusion>
<exclusion>
<groupId>jboss</groupId>
<artifactId>jboss-serialization</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>

View file

@ -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) {

View file

@ -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);

View file

@ -64,24 +64,17 @@ public class Session {
private final LinkedList<Long> 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<String> 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) {

View file

@ -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) {

View file

@ -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<UUID, Table> 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() + ")";
// }
// }
}

View file

@ -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<User> 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.
}
}

View file

@ -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);
}
}

View file

@ -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;
}