/** * Ends the current game and starts if neccessary the next game * * @return true if table can be closed */ public boolean endGameAndStartNextGame() { // get player that chooses who goes first Game game = match.getGame(); if (game == null) { return true; } UUID choosingPlayerId = match.getChooser(); match.endGame(); if (ConfigSettings.getInstance().isSaveGameActivated() && !game.isSimulation()) { if (GameManager.getInstance().saveGame(game.getId())) { match.setReplayAvailable(true); } } GameManager.getInstance().removeGame(game.getId()); try { if (!match.hasEnded()) { if (match.getGame() != null && match.getGame().getGameType().isSideboardingAllowed()) { sideboard(); } if (!match.hasEnded()) { startGame(choosingPlayerId); } else { closeTable(); } } else { closeTable(); } } catch (GameException ex) { logger.fatal(null, ex); } return match.hasEnded(); }
public void leaveTableAll() { for (UUID leavingUserId : userPlayerMap.keySet()) { leaveTable(leavingUserId); } closeTable(); }