public TableController(UUID roomId, UUID userId, TournamentOptions options) { this.userId = userId; tournament = TournamentFactory.instance.createTournament(options.getTournamentType(), options); if (userId != null) { Optional<User> user = UserManager.instance.getUser(userId); if (!user.isPresent()) { logger.fatal(new StringBuilder("User for userId ").append(userId).append(" could not be retrieved from UserManager").toString()); controllerName = "[unknown]"; } else { controllerName = user.get().getName(); } } else { controllerName = "System"; } table = new Table(roomId, options.getTournamentType(), options.getName(), controllerName, DeckValidatorFactory.instance.createDeckValidator(options.getMatchOptions().getDeckType()), options.getPlayerTypes(), TableRecorderImpl.instance, tournament, options.getMatchOptions().getBannedUsers(), options.isPlaneChase()); chatId = ChatManager.instance.createChatSession("Tourn. table " + table.getId()); }
if (maxAiOpponents != null) { int aiPlayers = 0; for (PlayerType playerType : options.getPlayerTypes()) { if (playerType != PlayerType.HUMAN) { aiPlayers++;
PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_PLAYERS_SEALED + versionStr, Integer.toString(tOptions.getPlayerTypes().size())); if (draftOptions != null) { PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_PACKS_DRAFT + versionStr, draftOptions.getSetCodes().toString()); PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_PLAYERS_DRAFT + versionStr, Integer.toString(tOptions.getPlayerTypes().size())); PreferencesDialog.saveValue(PreferencesDialog.KEY_NEW_TOURNAMENT_DRAFT_TIMING + versionStr, draftOptions.getTiming().name());
tOptions.setTournamentType(tournamentType.getName()); tOptions.setPassword(txtPassword.getText()); tOptions.getPlayerTypes().add(PlayerType.HUMAN); tOptions.setWatchingAllowed(cbAllowSpectators.isSelected()); tOptions.setPlaneChase(cbPlaneChase.isSelected()); tOptions.setMinimumRating((Integer) spnMinimumRating.getValue()); for (TournamentPlayerPanel player : players) { tOptions.getPlayerTypes().add((PlayerType) player.getPlayerType().getSelectedItem());