Skip to content

Commit

Permalink
Merge pull request #5277 from AaronGullickson/disconnect-quietly
Browse files Browse the repository at this point in the history
Add disconnectQuietly flag to ClientGUI
  • Loading branch information
AaronGullickson authored Mar 23, 2024
2 parents 8519eb5 + 6adecb4 commit de17471
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions megamek/src/megamek/client/ui/swing/ClientGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,9 @@ public class ClientGUI extends JPanel implements BoardViewListener,
private MiniReportDisplay miniReportDisplay;
private MiniReportDisplayDialog miniReportDisplayDialog;

/** Boolean indicating whether client should be disconnected without a pop-up warning **/
private boolean disconnectQuietly = false;

/**
* The <code>JPanel</code> containing the main display area.
*/
Expand Down Expand Up @@ -433,6 +436,10 @@ public void setPlayerListDialog(final PlayerListDialog playerListDialog) {
this.playerListDialog = playerListDialog;
}

public void setDisconnectQuietly(boolean quietly) {
disconnectQuietly = quietly;
}

/**
* Try to load the "bing" sound clip.
*/
Expand Down Expand Up @@ -2259,8 +2266,10 @@ public void gamePlayerChange(GamePlayerChangeEvent evt) {

@Override
public void gamePlayerDisconnected(GamePlayerDisconnectedEvent evt) {
doAlertDialog(Messages.getString("ClientGUI.Disconnected.message"),
Messages.getString("ClientGUI.Disconnected.title"), JOptionPane.ERROR_MESSAGE);
if(!disconnectQuietly) {
doAlertDialog(Messages.getString("ClientGUI.Disconnected.message"),
Messages.getString("ClientGUI.Disconnected.title"), JOptionPane.ERROR_MESSAGE);
}
frame.setVisible(false);
die();
}
Expand Down

0 comments on commit de17471

Please sign in to comment.