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());
}