Ejemplo n.º 1
0
 public TableController(UUID roomId, UUID userId, TournamentOptions options) {
   this.userId = userId;
   tournament =
       TournamentFactory.getInstance().createTournament(options.getTournamentType(), options);
   if (userId != null) {
     User user = UserManager.getInstance().getUser(userId);
     if (user == null) {
       logger.fatal(
           new StringBuilder("User for userId ")
               .append(userId)
               .append(" could not be retrieved from UserManager")
               .toString());
       controllerName = "[unknown]";
     } else {
       controllerName = user.getName();
     }
   } else {
     controllerName = "System";
   }
   table =
       new Table(
           roomId,
           options.getTournamentType(),
           options.getName(),
           controllerName,
           DeckValidatorFactory.getInstance()
               .createDeckValidator(options.getMatchOptions().getDeckType()),
           options.getPlayerTypes(),
           TableRecorderImpl.getInstance(),
           tournament);
   chatId = ChatManager.getInstance().createChatSession("Tourn. table " + table.getId());
 }
Ejemplo n.º 2
0
 public TableController(UUID roomId, UUID userId, MatchOptions options) {
   this.userId = userId;
   this.options = options;
   match = GameFactory.getInstance().createMatch(options.getGameType(), options);
   if (userId != null) {
     User user = UserManager.getInstance().getUser(userId);
     // TODO: Handle if user == null
     controllerName = user.getName();
   } else {
     controllerName = "System";
   }
   table =
       new Table(
           roomId,
           options.getGameType(),
           options.getName(),
           controllerName,
           DeckValidatorFactory.getInstance().createDeckValidator(options.getDeckType()),
           options.getPlayerTypes(),
           TableRecorderImpl.getInstance(),
           match);
   chatId = ChatManager.getInstance().createChatSession("Match Table " + table.getId());
   init();
 }