From 3e1f5c76320af8f051159307f0ec4b86dc8b3e0c Mon Sep 17 00:00:00 2001 From: austinio7116 Date: Sun, 8 Apr 2018 20:21:16 +0100 Subject: [PATCH] Added set code validation check to gameformat parser --- .../src/main/java/forge/game/GameFormat.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/forge-game/src/main/java/forge/game/GameFormat.java b/forge-game/src/main/java/forge/game/GameFormat.java index 15b03af0741..4f7ce8bdb58 100644 --- a/forge-game/src/main/java/forge/game/GameFormat.java +++ b/forge-game/src/main/java/forge/game/GameFormat.java @@ -74,7 +74,22 @@ public class GameFormat implements Comparable { this.index = compareIdx; this.formatType = formatType; this.name = fName; - allowedSetCodes = sets == null ? new ArrayList() : Lists.newArrayList(sets); + + if(sets != null) { + Set 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(); + } + bannedCardNames = bannedCards == null ? new ArrayList() : Lists.newArrayList(bannedCards); restrictedCardNames = restrictedCards == null ? new ArrayList() : Lists.newArrayList(restrictedCards); allowedRarities = rarities == null ? Lists.newArrayList() : rarities;