use of mage.game.result.ResultProtos.MatchQuitStatus in project mage by magefree.
the class MatchImpl method toProto.
@Override
public MatchProto toProto() {
MatchProto.Builder builder = MatchProto.newBuilder().setName(this.getName()).setGameType(this.getOptions().getGameType()).setDeckType(this.getOptions().getDeckType()).setGames(this.getNumGames()).setDraws(this.getDraws()).setMatchOptions(this.getOptions().toProto()).setEndTimeMs((this.getEndTime() != null ? this.getEndTime() : new Date()).getTime());
for (MatchPlayer matchPlayer : this.getPlayers()) {
MatchQuitStatus status = !matchPlayer.hasQuit() ? MatchQuitStatus.NO_MATCH_QUIT : matchPlayer.getPlayer().hasTimerTimeout() ? MatchQuitStatus.TIMER_TIMEOUT : matchPlayer.getPlayer().hasIdleTimeout() ? MatchQuitStatus.IDLE_TIMEOUT : MatchQuitStatus.QUIT;
builder.addPlayersBuilder().setName(matchPlayer.getName()).setHuman(matchPlayer.getPlayer().isHuman()).setQuit(status).setWins(matchPlayer.getWins());
}
return builder.build();
}
use of mage.game.result.ResultProtos.MatchQuitStatus in project mage by magefree.
the class TournamentImpl method matchToProto.
private MatchPlayerProto matchToProto(Match match, TournamentPlayer player) {
MatchPlayer matchPlayer = match.getPlayer(player.getPlayer().getId());
MatchQuitStatus quit = !matchPlayer.hasQuit() ? MatchQuitStatus.NO_MATCH_QUIT : matchPlayer.getPlayer().hasIdleTimeout() ? MatchQuitStatus.IDLE_TIMEOUT : matchPlayer.getPlayer().hasTimerTimeout() ? MatchQuitStatus.TIMER_TIMEOUT : MatchQuitStatus.QUIT;
return MatchPlayerProto.newBuilder().setName(player.getPlayer().getName()).setHuman(player.getPlayer().isHuman()).setWins(matchPlayer.getWins()).setQuit(quit).build();
}
Aggregations