}
}
// used for matches
private void initMatchTable(Table table) {
Match match = table.getMatch();
this.matchId = match.getId();
this.matchName = match.getName();
this.gameType = match.getOptions().getGameType();
if (table.getName() != null && !table.getName().isEmpty()) {
this.deckType = match.getOptions().getDeckType() + " [" + table.getName() + "]";
} else {
this.deckType = match.getOptions().getDeckType();
}
for (Game game: match.getGames()) {
games.add(game.getId());
}
StringBuilder sb1 = new StringBuilder();
StringBuilder sb2 = new StringBuilder();
for (MatchPlayer matchPlayer: match.getPlayers()) {
sb1.append(matchPlayer.getName());
if(matchPlayer.hasQuit()) {
if (matchPlayer.getPlayer().hasTimerTimeout()) {
sb1.append(" [timer] ");
} else if (matchPlayer.getPlayer().hasIdleTimeout()) {
sb1.append(" [idle] ");
} else {
sb1.append(" [quit] ");
}
}
int lostGames = match.getNumGames() - (matchPlayer.getWins() + match.getDraws());
sb1.append(", ");
sb2.append(matchPlayer.getName()).append(" [");
sb2.append(matchPlayer.getWins()).append("-");
if (match.getDraws() > 0) {
sb2.append(match.getDraws()).append("-");
}
sb2.append(lostGames).append("], ");
}
if (sb1.length() > 2) {
players = sb1.substring(0, sb1.length() - 2);
result = sb2.substring(0, sb2.length() - 2);
} else {
players = "[no players]";
result = "";
}
this.startTime = match.getStartTime();
this.endTime = match.getEndTime();
this.replayAvailable = match.isReplayAvailable();
}