コード例 #1
0
ファイル: TableController.java プロジェクト: magefree/mage
  public synchronized boolean replaceDraftPlayer(
      Player oldPlayer, String name, String playerType, int skill) {
    Player newPlayer = createPlayer(name, playerType, skill);
    if (newPlayer == null || table.getState() != TableState.DRAFTING) {
      return false;
    }
    TournamentPlayer oldTournamentPlayer = tournament.getPlayer(oldPlayer.getId());
    tournament.removePlayer(oldPlayer.getId());
    tournament.addPlayer(newPlayer, playerType);

    TournamentPlayer newTournamentPlayer = tournament.getPlayer(newPlayer.getId());
    newTournamentPlayer.setState(oldTournamentPlayer.getState());
    newTournamentPlayer.setReplacedTournamentPlayer(oldTournamentPlayer);

    DraftManager.getInstance().getController(table.getId()).replacePlayer(oldPlayer, newPlayer);
    return true;
  }
コード例 #2
0
ファイル: TableController.java プロジェクト: magefree/mage
 public void startDraft(Draft draft) {
   table.initDraft();
   DraftManager.getInstance().createDraftSession(draft, userPlayerMap, table.getId());
   for (Entry<UUID, UUID> entry : userPlayerMap.entrySet()) {
     User user = UserManager.getInstance().getUser(entry.getKey());
     if (user != null) {
       logger.info(
           new StringBuilder("User ")
               .append(user.getName())
               .append(" draft started: ")
               .append(draft.getId())
               .append(" userId: ")
               .append(user.getId()));
       user.ccDraftStarted(draft.getId(), entry.getValue());
     } else {
       logger.fatal(
           new StringBuilder("Start draft user not found userId: ").append(entry.getKey()));
     }
   }
 }