Changed user disconnect handling. The user in the server is no longer deleted directly after connection problem, disconnect or quit. The user object remains now for 8 minutes so the rejoin not possible after disconnect problem should be solved (I hope so). We will see. Also fixed the problem, that the table panel was not shown, if a player disconected and reconected.

This commit is contained in:
LevelX2 2017-08-13 16:22:18 +02:00
parent 5dbb89772e
commit bae7f154df
10 changed files with 220 additions and 170 deletions

View file

@ -1022,8 +1022,9 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
// Show the tables pane if there wasn't already an active pane
MagePane topPanebefore = getTopMost(tablesPane);
if (topPanebefore == null) {
setActive(tablesPane);
setActive(tablesPane);
if (topPanebefore != null && topPanebefore != tablesPane) {
setActive(topPanebefore);
}
}
@ -1189,7 +1190,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
private static final long serialVersionUID = -9104885239063142218L;
private ImagePanel backgroundPane;
private TablesPane tablesPane;
private final TablesPane tablesPane;
// private CollectionViewerPane collectionViewerPane;
public void setStatusText(String status) {
@ -1319,7 +1320,10 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
DownloadPictures.startDownload(null, missingCards);
break;
case CLIENT_DISCONNECT:
SessionHandler.disconnect(false);
if (SessionHandler.isConnected()) {
endTables();
SessionHandler.disconnect(false);
}
tablesPane.clearChat();
showMessage("You have disconnected");
setWindowTitle();
@ -1347,6 +1351,7 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
break;
case CLIENT_EXIT:
if (SessionHandler.isConnected()) {
endTables();
SessionHandler.disconnect(false);
}
CardRepository.instance.closeDB();
@ -1374,6 +1379,15 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
}
}
private void endTables() {
for (UUID gameId : GAMES.keySet()) {
SessionHandler.quitMatch(gameId);
}
for (UUID draftId : DRAFTS.keySet()) {
SessionHandler.quitDraft(draftId);
}
}
public void changeGUISize() {
ImageCaches.flush();
setGUISize();