コード例 #1
0
ファイル: TableController.java プロジェクト: magefree/mage
 /**
  * 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();
 }
コード例 #2
0
ファイル: TableController.java プロジェクト: magefree/mage
 public void leaveTableAll() {
   for (UUID leavingUserId : userPlayerMap.keySet()) {
     leaveTable(leavingUserId);
   }
   closeTable();
 }