* GUI: fixed random/richman tourney settings that allows to freeze the client (#8224);

This commit is contained in:
Oleg Agafonov 2023-03-17 23:04:11 +04:00
parent 0bcf0320d0
commit 00ebef654f
2 changed files with 23 additions and 20 deletions

View file

@ -680,8 +680,13 @@ public class NewTournamentDialog extends MageDialog {
// CHECKS
TournamentTypeView tournamentType = (TournamentTypeView) cbTournamentType.getSelectedItem();
if (tournamentType.isRandom() || tournamentType.isRichMan()) {
if (tOptions.getLimitedOptions().getSetCodes().isEmpty()) {
JOptionPane.showMessageDialog(MageFrame.getDesktop(), "Warning, you must select packs for the pool", "Warning", JOptionPane.WARNING_MESSAGE);
if (tOptions.getLimitedOptions().getSetCodes().size() < tournamentType.getNumBoosters()) {
JOptionPane.showMessageDialog(
MageFrame.getDesktop(),
String.format("Warning, you must select %d packs for the pool", tournamentType.getNumBoosters()),
"Warning",
JOptionPane.WARNING_MESSAGE
);
return;
}
}
@ -1013,7 +1018,7 @@ public class NewTournamentDialog extends MageDialog {
private void createRandomPacks() {
if (pnlRandomPacks.getComponentCount() == 0) {
if (randomPackSelector == null) {
randomPackSelector = new RandomPacksSelectorDialog(isRandom, isRichMan);
randomPackSelector = new RandomPacksSelectorDialog();
randomPackSelector.setLocationRelativeTo(this);
}
txtRandomPacks = new JTextArea();
@ -1039,8 +1044,8 @@ public class NewTournamentDialog extends MageDialog {
}
private void showRandomPackSelectorDialog() {
randomPackSelector.setType(isRandom, isRichMan);
randomPackSelector.showDialog();
TournamentTypeView tournamentType = (TournamentTypeView) cbTournamentType.getSelectedItem();
randomPackSelector.showDialog(isRandom, isRichMan, tournamentType.getNumBoosters());
this.txtRandomPacks.setText(String.join(";", randomPackSelector.getSelectedPacks()));
this.pack();
this.revalidate();