Fixed a bug that a tournament match did not end, if a player left during sideboarding.

This commit is contained in:
LevelX2 2014-11-27 18:41:33 +01:00
parent 61edeb4809
commit f85f477b90
2 changed files with 6 additions and 7 deletions

View file

@ -45,6 +45,8 @@ import mage.players.net.UserData;
import mage.server.draft.DraftSession; import mage.server.draft.DraftSession;
import mage.server.game.GameManager; import mage.server.game.GameManager;
import mage.server.game.GameSessionPlayer; import mage.server.game.GameSessionPlayer;
import mage.server.tournament.TournamentController;
import mage.server.tournament.TournamentManager;
import mage.server.tournament.TournamentSession; import mage.server.tournament.TournamentSession;
import mage.server.util.SystemUtil; import mage.server.util.SystemUtil;
import mage.view.TableClientMessage; import mage.view.TableClientMessage;
@ -348,6 +350,10 @@ public class User {
draftSessions.clear(); draftSessions.clear();
logger.debug("REMOVE " + getName() + " Tournament sessions " + tournamentSessions.size()); logger.debug("REMOVE " + getName() + " Tournament sessions " + tournamentSessions.size());
for (TournamentSession tournamentSession: tournamentSessions.values()) { for (TournamentSession tournamentSession: tournamentSessions.values()) {
TournamentController tournamentController = TournamentManager.getInstance().getTournamentController(tournamentSession.getTournamentId());
if (tournamentController != null) {
tournamentController.quit(userId);
}
tournamentSession.setKilled(); tournamentSession.setKilled();
} }
tournamentSessions.clear(); tournamentSessions.clear();

View file

@ -416,13 +416,6 @@ public class TournamentController {
return tournament.isAbort(); return tournament.isAbort();
} }
public boolean isPlayerAlive(UUID playerId) {
if (tournamentSessions.containsKey(playerId)) {
return tournamentSessions.get(playerId).isKilled();
}
return false;
}
private void checkPlayersState() { private void checkPlayersState() {
for (TournamentPlayer tournamentPlayer: tournament.getPlayers()) { for (TournamentPlayer tournamentPlayer: tournament.getPlayers()) {
if (!tournamentPlayer.isEliminated() && tournamentPlayer.getPlayer().isHuman()) { if (!tournamentPlayer.isEliminated() && tournamentPlayer.getPlayer().isHuman()) {