forked from External/mage
Exclude custom sets from constructed formats.
This commit is contained in:
parent
238c88a8b6
commit
74a017586a
3 changed files with 42 additions and 25 deletions
|
|
@ -30,11 +30,7 @@ package mage.cards;
|
|||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.*;
|
||||
|
||||
import mage.cards.decks.DeckCardInfo;
|
||||
import mage.cards.decks.DeckCardLists;
|
||||
|
|
@ -61,6 +57,8 @@ public class Sets extends HashMap<String, ExpansionSet> {
|
|||
return fINSTANCE;
|
||||
}
|
||||
|
||||
private Set<String> customSets = new HashSet<>();
|
||||
|
||||
private Sets() {
|
||||
ArrayList<String> packages = new ArrayList<>();
|
||||
packages.add("mage.sets");
|
||||
|
|
@ -72,8 +70,14 @@ public class Sets extends HashMap<String, ExpansionSet> {
|
|||
}
|
||||
}
|
||||
|
||||
private void addSet(ExpansionSet set) {
|
||||
public void addSet(ExpansionSet set) {
|
||||
if(containsKey(set.getCode())) throw new IllegalArgumentException("Set code "+set.getCode()+" already exists.");
|
||||
this.put(set.getCode(), set);
|
||||
if(set.isCustomSet) customSets.add(set.getCode());
|
||||
}
|
||||
|
||||
public static boolean isCustomSet(String setCode) {
|
||||
return getInstance().customSets.contains(setCode);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue