mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
* Imporoved release of draft object during draft tournament.
This commit is contained in:
parent
4e56e584b6
commit
adbd1bca94
4 changed files with 19 additions and 3 deletions
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -95,5 +95,7 @@ public interface Tournament {
|
|||
void cleanUpOnTournamentEnd();
|
||||
boolean isAbort();
|
||||
void setAbort(boolean abort);
|
||||
|
||||
void clearDraft();
|
||||
Draft getDraft();
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue