Added set code validation check to gameformat parser

This commit is contained in:
austinio7116
2018-04-08 20:21:16 +01:00
committed by maustin
parent 00a2a1ef4d
commit 3e1f5c7632

View File

@@ -74,7 +74,22 @@ public class GameFormat implements Comparable<GameFormat> {
this.index = compareIdx;
this.formatType = formatType;
this.name = fName;
allowedSetCodes = sets == null ? new ArrayList<String>() : Lists.newArrayList(sets);
if(sets != null) {
Set<String> parsedSets = new HashSet<>();
for (String set : sets) {
if (StaticData.instance().getEditions().get(set) == null) {
System.out.println("Set " + set + " in format " + fName + " does not match any valid editions!");
continue;
}
parsedSets.add(set);
}
allowedSetCodes = Lists.newArrayList(parsedSets);
}else{
allowedSetCodes = new ArrayList<String>();
}
bannedCardNames = bannedCards == null ? new ArrayList<String>() : Lists.newArrayList(bannedCards);
restrictedCardNames = restrictedCards == null ? new ArrayList<String>() : Lists.newArrayList(restrictedCards);
allowedRarities = rarities == null ? Lists.newArrayList() : rarities;