From ef811ff0bf1610eaf979daba62aa91f3c75d9752 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Mon, 1 Jul 2013 20:26:55 +0200 Subject: [PATCH] Improved state handling of tournament panel. --- .../mage/tournament/BoosterDraftEliminationTournament.java | 5 +---- .../src/mage/tournament/SealedEliminationTournament.java | 7 ++----- Mage/src/mage/game/tournament/TournamentImpl.java | 5 ----- .../mage/game/tournament/TournamentSingleElimination.java | 7 +++++++ 4 files changed, 10 insertions(+), 14 deletions(-) diff --git a/Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/BoosterDraftEliminationTournament.java b/Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/BoosterDraftEliminationTournament.java index 1cdd94fb02..be436a638f 100644 --- a/Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/BoosterDraftEliminationTournament.java +++ b/Mage.Server.Plugins/Mage.Tournament.BoosterDraft/src/mage/tournament/BoosterDraftEliminationTournament.java @@ -63,10 +63,7 @@ public class BoosterDraftEliminationTournament extends TournamentSingleEliminati tableEventSource.fireTableEvent(EventType.START_DRAFT, null, draft); } - protected void winners() { - // TODO: Show winners and tournament result - // throw new UnsupportedOperationException("Not supported yet."); - } + @Override public void nextStep() { diff --git a/Mage.Server.Plugins/Mage.Tournament.Sealed/src/mage/tournament/SealedEliminationTournament.java b/Mage.Server.Plugins/Mage.Tournament.Sealed/src/mage/tournament/SealedEliminationTournament.java index 7f8689f954..d3079d976d 100644 --- a/Mage.Server.Plugins/Mage.Tournament.Sealed/src/mage/tournament/SealedEliminationTournament.java +++ b/Mage.Server.Plugins/Mage.Tournament.Sealed/src/mage/tournament/SealedEliminationTournament.java @@ -28,7 +28,9 @@ package mage.tournament; +import mage.constants.TournamentPlayerState; import mage.game.tournament.TournamentOptions; +import mage.game.tournament.TournamentPlayer; import mage.game.tournament.TournamentSingleElimination; /** @@ -48,11 +50,6 @@ public class SealedEliminationTournament extends TournamentSingleElimination { currentStep = TournamentStep.START; } - protected void winners() { - // TODO: Show winners and tournament result - // throw new UnsupportedOperationException("Not supported yet."); - } - @Override public void nextStep() { switch (currentStep) { diff --git a/Mage/src/mage/game/tournament/TournamentImpl.java b/Mage/src/mage/game/tournament/TournamentImpl.java index 5b799504f3..b3ae7df111 100644 --- a/Mage/src/mage/game/tournament/TournamentImpl.java +++ b/Mage/src/mage/game/tournament/TournamentImpl.java @@ -147,11 +147,6 @@ public abstract class TournamentImpl implements Tournament { Round round = new Round(rounds.size() + 1); rounds.add(round); List roundPlayers = getActivePlayers(); - if (roundPlayers.size() == 1) { - TournamentPlayer winner = roundPlayers.get(0); - winner.setState(TournamentPlayerState.FINISHED); - winner.setStateInfo("Winner"); - } while (roundPlayers.size() > 1) { int i = rnd.nextInt(roundPlayers.size()); TournamentPlayer player1 = roundPlayers.get(i); diff --git a/Mage/src/mage/game/tournament/TournamentSingleElimination.java b/Mage/src/mage/game/tournament/TournamentSingleElimination.java index ed3437c8ef..f369e01956 100644 --- a/Mage/src/mage/game/tournament/TournamentSingleElimination.java +++ b/Mage/src/mage/game/tournament/TournamentSingleElimination.java @@ -30,6 +30,7 @@ package mage.game.tournament; import java.util.Map; import java.util.UUID; +import mage.constants.TournamentPlayerState; /** * @@ -65,5 +66,11 @@ public abstract class TournamentSingleElimination extends TournamentImpl { } } + protected void winners() { + for(TournamentPlayer winner: this.getActivePlayers()) { + winner.setState(TournamentPlayerState.FINISHED); + winner.setStateInfo("Winner"); + } + } }