mirror of
https://github.com/correl/mage.git
synced 2025-01-11 19:13:02 +00:00
Handling of players that cancel tournament improved.
This commit is contained in:
parent
41034ccdd8
commit
6098aa1d7c
5 changed files with 20 additions and 2 deletions
|
@ -89,8 +89,12 @@ public class MatchView implements Serializable {
|
|||
}
|
||||
this.players = sb1.toString();
|
||||
StringBuilder sb2 = new StringBuilder();
|
||||
for (TournamentPlayer tPlayer : table.getTournament().getPlayers()) {
|
||||
sb2.append(tPlayer.getPlayer().getName()).append(": ").append(tPlayer.getResults()).append(" ");
|
||||
if (table.getTournament().getRounds().size() > 0) {
|
||||
for (TournamentPlayer tPlayer : table.getTournament().getPlayers()) {
|
||||
sb2.append(tPlayer.getPlayer().getName()).append(": ").append(tPlayer.getResults()).append(" ");
|
||||
}
|
||||
} else {
|
||||
sb2.append("Canceled");
|
||||
}
|
||||
this.result = sb2.toString();
|
||||
this.startTime = table.getTournament().getStartTime();
|
||||
|
|
|
@ -53,6 +53,7 @@ import mage.game.match.MatchOptions;
|
|||
import mage.game.match.MatchPlayer;
|
||||
import mage.game.tournament.Tournament;
|
||||
import mage.game.tournament.TournamentOptions;
|
||||
import mage.game.tournament.TournamentPlayer;
|
||||
import mage.players.Player;
|
||||
import mage.server.challenge.ChallengeManager;
|
||||
import mage.server.draft.DraftManager;
|
||||
|
@ -216,6 +217,10 @@ public class TableController {
|
|||
|
||||
public synchronized boolean submitDeck(UUID userId, DeckCardLists deckList) throws MageException {
|
||||
UUID playerId = userPlayerMap.get(userId);
|
||||
TournamentPlayer player = tournament.getPlayer(playerId);
|
||||
if (player.hasQuit()) {
|
||||
return true; // so the construct panel closes after submit
|
||||
}
|
||||
if (table.getState() != TableState.SIDEBOARDING && table.getState() != TableState.CONSTRUCTING) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -275,6 +275,7 @@ public class TournamentController {
|
|||
info = "during Construction phase";
|
||||
}
|
||||
player.setQuit(info);
|
||||
tournament.quit(playerId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,6 +63,7 @@ public interface Tournament {
|
|||
void autoSubmit(UUID playerId, Deck deck);
|
||||
boolean allJoined();
|
||||
boolean isDoneConstructing();
|
||||
void quit(UUID playerId);
|
||||
void leave(UUID playerId);
|
||||
void nextStep();
|
||||
|
||||
|
|
|
@ -118,6 +118,13 @@ public abstract class TournamentImpl implements Tournament {
|
|||
return setsInfoShort;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void quit(UUID playerId) {
|
||||
synchronized (this) {
|
||||
this.notifyAll();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void leave(UUID playerId) {
|
||||
if (players.containsKey(playerId)) {
|
||||
|
|
Loading…
Reference in a new issue