public Table(UUID roomId, String gameType, String name, String controllerName, DeckValidator validator, List<PlayerType> playerTypes, TableRecorder recorder, Match match, Set<String> bannedUsernames, boolean isPlaneChase) { this(roomId, gameType, name, controllerName, validator, playerTypes, recorder, bannedUsernames, isPlaneChase); this.match = match; this.isTournament = false; setState(TableState.WAITING); }
public Table(UUID roomId, String gameType, String name, String controllerName, DeckValidator validator, List<PlayerType> playerTypes, TableRecorder recorder, Tournament tournament, Set<String> bannedUsernames, boolean isPlaneChase) { this(roomId, gameType, name, controllerName, validator, playerTypes, recorder, bannedUsernames, isPlaneChase); this.tournament = tournament; this.isTournament = true; setState(TableState.WAITING); }
public void endTournament() { setState(TableState.FINISHED); }
public void initGame() { setState(TableState.DUELING); }
public void sideboard() { setState(TableState.SIDEBOARDING); }
public void initDraft() { setState(TableState.DRAFTING); tournament.setStepStartTime(new Date()); }
public void initTournament() { setState(TableState.DUELING); tournament.setStepStartTime(new Date()); }
public void construct() { setState(TableState.CONSTRUCTING); tournament.setStepStartTime(new Date()); }
/** * All activities of the table end (only replay of games (if active) and * display tournament results) */ public void closeTable() { if (getState() != TableState.WAITING && getState() != TableState.READY_TO_START) { setState(TableState.FINISHED); // otherwise the table can be removed completely } this.validator = null; }
public synchronized boolean changeTableStateToStarting() { if (table.getState() != TableState.READY_TO_START) { // tournament is not ready, can't start return false; } if (!table.allSeatsAreOccupied()) { logger.debug("Not alle Seats are occupied: stop start tableId:" + table.getId()); return false; } table.setState(TableState.STARTING); return true; } }
public void leaveNotStartedTable(UUID playerId) { for (int i = 0; i < numSeats; i++) { Player player = seats[i].getPlayer(); if (player != null && player.getId().equals(playerId)) { seats[i].setPlayer(null); if (getState() == TableState.READY_TO_START) { setState(TableState.WAITING); } break; } } }
public UUID joinTable(Player player, Seat seat) throws GameException { if (seat.getPlayer() != null) { throw new GameException("Seat is occupied."); } seat.setPlayer(player); if (isReady()) { setState(TableState.READY_TO_START); } return seat.getPlayer().getId(); }
private void startMultiplayerMatch(MultiplayerRound round, MatchOptions matchOptions) { try { TableManager tableManager = TableManager.instance; Table table = tableManager.createTable(GamesRoomManager.instance.getMainRoomId(), matchOptions); table.setTournamentSubTable(true); table.setTournament(tournament); table.setState(TableState.WAITING); if (round.getAllPlayers().stream().allMatch(tournamentPlayer -> getPlayerUserId(tournamentPlayer.getPlayer().getId()).isPresent())) { for (TournamentPlayer player : round.getAllPlayers()) { tableManager.addPlayer(getPlayerUserId(player.getPlayer().getId()).get(), table.getId(), player); } table.setState(TableState.STARTING); tableManager.startTournamentSubMatch(null, table.getId()); tableManager.getMatch(table.getId()).ifPresent(match -> { match.setTableId(tableId); round.setMatch(match); round.setTableId(table.getId()); for (TournamentPlayer player : round.getAllPlayers()) { player.setState(TournamentPlayerState.DUELING); } }); } } catch (GameException ex) { logger.fatal("TournamentController startMatch error", ex); } }
table.setTournamentSubTable(true); table.setTournament(tournament); table.setState(TableState.WAITING); TournamentPlayer player1 = pair.getPlayer1(); TournamentPlayer player2 = pair.getPlayer2(); table.setState(TableState.STARTING); tableManager.startTournamentSubMatch(null, table.getId()); tableManager.getMatch(table.getId()).ifPresent(match -> {