@Override public UUID getChooser() { UUID loserId = null; Game game = getGame(); for (MatchPlayer player : this.players) { Player p = game.getPlayer(player.getPlayer().getId()); if (p != null && p.hasLost() && !p.hasQuit()) { loserId = p.getId(); } } return loserId; }
sb.append(player.hasWon() ? "W" : ""); sb.append(player.hasLost() ? "L" : ""); sb.append(player.hasQuit() ? "Q" : ""); sb.append(player.hasIdleTimeout() ? "I" : ""); sb.append(player.hasTimerTimeout() ? "T" : "");
@Override public boolean hasEnded() { // Some workarounds to end match if for unknown reason the match was not ended regularly if (getGame() == null && isDoneSideboarding()) { checkIfMatchEnds(); } if (getGame() != null && getGame().hasEnded()) { for (MatchPlayer matchPlayer : players) { if (matchPlayer.getPlayer().hasQuit() && !matchPlayer.hasQuit()) { logger.warn("MatchPlayer was not set to quit matchId " + this.getId() + " - " + matchPlayer.getName()); matchPlayer.setQuit(true); } } checkIfMatchEnds(); } return endTime != null; }
@Override public void endGame() { Game game = getGame(); for (MatchPlayer matchPlayer : this.players) { Player player = game.getPlayer(matchPlayer.getPlayer().getId()); if (player != null) { // get the left time from player priority timer if (game.getPriorityTime() > 0) { matchPlayer.setPriorityTimeLeft(player.getPriorityTimeLeft()); } if (player.hasQuit()) { matchPlayer.setQuit(true); } if (player.hasWon()) { matchPlayer.addWin(); } } } if (game.isADraw()) { addDraw(); } checkIfMatchEnds(); game.fireGameEndInfo(); gamesInfo.add(createGameInfo(game)); }