* Imporoved release of draft object during draft tournament.

This commit is contained in:
LevelX2 2015-02-06 00:23:01 +01:00
parent 4e56e584b6
commit adbd1bca94
4 changed files with 19 additions and 3 deletions

View file

@ -823,10 +823,13 @@ public class TableController {
}
public void endDraft(Draft draft) {
for (DraftPlayer player: draft.getPlayers()) {
player.prepareDeck();
tournament.getPlayer(player.getPlayer().getId()).setDeck(player.getDeck());
if (!draft.isAbort()) {
for (DraftPlayer player: draft.getPlayers()) {
player.prepareDeck();
tournament.getPlayer(player.getPlayer().getId()).setDeck(player.getDeck());
}
}
tournament.clearDraft(); // free the draft resources after draft step has ended
tournament.nextStep();
}

View file

@ -198,6 +198,7 @@ public class DraftController {
draftSession.removeDraft();
}
TableManager.getInstance().endDraft(tableId, draft);
DraftManager.getInstance().removeDraft(draft.getId());
}
public void kill(UUID userId) {
@ -259,5 +260,10 @@ public class DraftController {
public void abortDraft() {
draft.setAbort(true);
try {
endDraft();
} catch(MageException ex) {
}
}
}

View file

@ -95,5 +95,7 @@ public interface Tournament {
void cleanUpOnTournamentEnd();
boolean isAbort();
void setAbort(boolean abort);
void clearDraft();
Draft getDraft();
}

View file

@ -503,6 +503,11 @@ public abstract class TournamentImpl implements Tournament {
this.stepStartTime = stepStartTime;
}
@Override
public void clearDraft() {
draft = null;
}
@Override
public Draft getDraft() {
return draft;