mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 11:32:00 -08:00
Fixed a bug that while a match or tournament was just starting a player could still leave the table, setting the table / tournament / match to an undefined state. Now the player can only leave the Match / Tournament if it has started properly.
This commit is contained in:
parent
3f5f6a6166
commit
fec0744315
10 changed files with 159 additions and 100 deletions
|
|
@ -82,7 +82,7 @@ public class TableWaitingDialog extends MageDialog {
|
|||
try {
|
||||
if (table != null) {
|
||||
switch (table.getTableState()) {
|
||||
case STARTING:
|
||||
case READY_TO_START:
|
||||
this.btnStart.setEnabled(true);
|
||||
this.btnMoveDown.setEnabled(true);
|
||||
this.btnMoveUp.setEnabled(true);
|
||||
|
|
@ -245,12 +245,15 @@ public class TableWaitingDialog extends MageDialog {
|
|||
|
||||
private void btnStartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnStartActionPerformed
|
||||
if (!isTournament) {
|
||||
session.startMatch(roomId, tableId);
|
||||
if (session.startMatch(roomId, tableId)) {
|
||||
closeDialog();
|
||||
}
|
||||
}
|
||||
else {
|
||||
session.startTournament(roomId, tableId);
|
||||
}
|
||||
closeDialog();
|
||||
if (session.startTournament(roomId, tableId)) {
|
||||
closeDialog();
|
||||
}
|
||||
}
|
||||
}//GEN-LAST:event_btnStartActionPerformed
|
||||
|
||||
private void btnCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelActionPerformed
|
||||
|
|
@ -258,7 +261,9 @@ public class TableWaitingDialog extends MageDialog {
|
|||
if (session.isTableOwner(roomId, tableId)) {
|
||||
session.removeTable(roomId, tableId);
|
||||
} else {
|
||||
session.leaveTable(roomId, tableId);
|
||||
if (!session.leaveTable(roomId, tableId)) {
|
||||
return; // already started, so leave no more possible
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
//swallow exception
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue