Tournament handling - small change to check who to eliminate.

This commit is contained in:
LevelX2 2014-05-03 02:48:24 +02:00
parent 15e3fd906e
commit 7318ecb50e

View file

@ -71,14 +71,17 @@ public class TournamentPairing {
this.match = match; this.match = match;
} }
/**
* Called by eliminate tournaments after each match
*/
public void eliminatePlayers() { public void eliminatePlayers() {
if (match.hasEnded()) { if (match.hasEnded()) {
MatchPlayer mPlayer1 = match.getPlayer(player1.getPlayer().getId()); MatchPlayer mPlayer1 = match.getPlayer(player1.getPlayer().getId());
MatchPlayer mPlayer2 = match.getPlayer(player2.getPlayer().getId()); MatchPlayer mPlayer2 = match.getPlayer(player2.getPlayer().getId());
if (mPlayer1.hasQuit() || (!mPlayer2.hasQuit() && mPlayer1.getWins() < match.getWinsNeeded())) { if (mPlayer1.hasQuit() || !mPlayer1.isMatchWinner()) {
player1.setEliminated(); player1.setEliminated();
} }
if (mPlayer2.hasQuit() || (!mPlayer1.hasQuit() && mPlayer2.getWins() < match.getWinsNeeded())) { if (mPlayer2.hasQuit() || !mPlayer2.isMatchWinner()) {
player2.setEliminated(); player2.setEliminated();
} }
} }