* Draft - Added "Quit Tournament" button to draft panel. Minor formatting.

This commit is contained in:
LevelX2 2014-02-28 17:47:27 +01:00
parent 024ec1169a
commit 8d2f4cc9ac
26 changed files with 340 additions and 157 deletions

View file

@ -40,6 +40,7 @@ import mage.cards.repository.CardRepository;
import mage.cards.repository.ExpansionInfo;
import mage.cards.repository.ExpansionRepository;
import mage.game.GameException;
import mage.game.Table;
import mage.game.match.MatchOptions;
import mage.game.tournament.TournamentOptions;
import mage.interfaces.Action;
@ -659,6 +660,22 @@ public class MageServerImpl implements MageServer {
});
}
@Override
public void quitDraft(final UUID draftId, final String sessionId) throws MageException {
execute("quitDraft", sessionId, new Action() {
@Override
public void execute() {
UUID tableId = DraftManager.getInstance().getControllerByDraftId(draftId).getTableId();
UUID userId = SessionManager.getInstance().getSession(sessionId).getUserId();
Table table = TableManager.getInstance().getTable(tableId);
if (table.isTournament()) {
UUID tournamentId = table.getTournament().getId();
TournamentManager.getInstance().quit(tournamentId, userId);
}
}
});
}
@Override
public void undo(final UUID gameId, final String sessionId) throws MageException {
execute("undo", sessionId, new Action() {