private void sideboard() { table.sideboard(); setupTimeout(Match.SIDEBOARD_TIME); if (table.isTournamentSubTable()) { for (MatchPlayer matchPlayer : match.getPlayers()) { if (!matchPlayer.hasQuit()) { TournamentPlayer tournamentPlayer = table.getTournament().getPlayer(matchPlayer.getPlayer().getId()); if (tournamentPlayer != null) { tournamentPlayer.setStateInfo("sideboarding"); } } } } match.sideboard(); cancelTimeout(); if (table.isTournamentSubTable()) { for (MatchPlayer matchPlayer : match.getPlayers()) { TournamentPlayer tournamentPlayer = table.getTournament().getPlayer(matchPlayer.getPlayer().getId()); if (tournamentPlayer != null && tournamentPlayer.getStateInfo().equals("sideboarding")) { tournamentPlayer.setStateInfo(""); } } } }
private synchronized void setupTimeout(int seconds) { cancelTimeout(); if (seconds > 0) { futureTimeout = timeoutExecutor.schedule( new Runnable() { @Override public void run() { autoSideboard(); } }, seconds, TimeUnit.SECONDS); } }