mirror of
https://github.com/correl/mage.git
synced 2025-01-12 19:25:44 +00:00
* Table handling - Fixed a bug that if table owner tried to create a table with invalid deck, the table was added to the finished tables with no players.
This commit is contained in:
parent
f4b4184d99
commit
a57ebc5314
3 changed files with 9 additions and 7 deletions
|
@ -258,12 +258,8 @@ public class TableWaitingDialog extends MageDialog {
|
|||
|
||||
private void btnCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelActionPerformed
|
||||
try {
|
||||
if (session.isTableOwner(roomId, tableId)) {
|
||||
session.removeTable(roomId, tableId);
|
||||
} else {
|
||||
if (!session.leaveTable(roomId, tableId)) {
|
||||
return; // already started, so leave no more possible
|
||||
}
|
||||
if (!session.leaveTable(roomId, tableId)) {
|
||||
return; // already started, so leave no more possible
|
||||
}
|
||||
} catch (Exception e) {
|
||||
//swallow exception
|
||||
|
|
|
@ -231,6 +231,10 @@ public class TableController {
|
|||
}
|
||||
sb.append("\n\nSelect a deck that is appropriate for the selected format and try again!");
|
||||
user.showUserMessage("Join Table", sb.toString());
|
||||
if (isOwner(userId)) {
|
||||
logger.debug("New table removed because owner submitted invalid deck tableId " + table.getId());
|
||||
TableManager.getInstance().removeTable(table.getId());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -136,7 +136,9 @@ public class Table implements Serializable {
|
|||
*
|
||||
*/
|
||||
public void closeTable() {
|
||||
setState(TableState.FINISHED);
|
||||
if (!getState().equals(TableState.WAITING) && !getState().equals(TableState.READY_TO_START)) {
|
||||
setState(TableState.FINISHED); // otherwise the table can be removed completely
|
||||
}
|
||||
this.validator = null;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue