diff --git a/forge-game/src/main/java/forge/game/GameFormat.java b/forge-game/src/main/java/forge/game/GameFormat.java index 6e1ee9911d6..68469242033 100644 --- a/forge-game/src/main/java/forge/game/GameFormat.java +++ b/forge-game/src/main/java/forge/game/GameFormat.java @@ -34,7 +34,6 @@ import forge.item.PaperCard; import forge.util.FileSection; import forge.util.FileUtil; import forge.util.storage.StorageBase; -import forge.util.storage.StorageReaderFolder; import forge.util.storage.StorageReaderRecursiveFolderWithUserFolder; import java.io.File; @@ -60,7 +59,7 @@ public class GameFormat implements Comparable { protected final List restrictedCardNames; protected final List additionalCardNames; // for cards that are legal but not reprinted in any of the allowed Sets protected boolean restrictedLegendary = false; - private Date date; + private Date effectiveDate; private final static SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); protected final transient List allowedSetCodes_ro; @@ -74,18 +73,20 @@ public class GameFormat implements Comparable { private final int index; public GameFormat(final String fName, final Iterable sets, final List bannedCards) { - this(fName, sets, bannedCards, null, false, null, null, 0, FormatType.Custom, FormatSubType.Custom); + this(fName, parseDate("1990-01-01"), sets, bannedCards, null, false, null, null, 0, FormatType.Custom, FormatSubType.Custom); } - public static final GameFormat NoFormat = new GameFormat("(none)", null, null, null, false, null, null, Integer.MAX_VALUE, FormatType.Custom, FormatSubType.Custom); + public static final GameFormat NoFormat = new GameFormat("(none)", parseDate("1990-01-01") , null, null, null, false + , null, null, Integer.MAX_VALUE, FormatType.Custom, FormatSubType.Custom); - public GameFormat(final String fName, final Iterable sets, final List bannedCards, + public GameFormat(final String fName, final Date effectiveDate, final Iterable sets, final List bannedCards, final List restrictedCards, Boolean restrictedLegendary, final List additionalCards, final List rarities, int compareIdx, FormatType formatType, FormatSubType formatSubType) { this.index = compareIdx; this.formatType = formatType; this.formatSubType = formatSubType; this.name = fName; + this.effectiveDate = effectiveDate; if(sets != null) { Set parsedSets = new HashSet<>(); @@ -158,7 +159,7 @@ public class GameFormat implements Comparable { } } - public Date getDate() { return date; } + public Date getEffectiveDate() { return effectiveDate; } public FormatType getFormatType() { return this.formatType; @@ -269,6 +270,9 @@ public class GameFormat implements Comparable { return formatSubType.compareTo(other.formatSubType); } } + if (formatType.equals(FormatType.Historic)){ + return effectiveDate.compareTo(other.effectiveDate); + } return name.compareTo(other.name); //return index - other.index; } @@ -308,7 +312,7 @@ public class GameFormat implements Comparable { formatsubType = FormatSubType.Custom; } Integer idx = section.getInt("order"); - Date date = parseDate(section.get("date")); + Date date = parseDate(section.get("effectivedate")); String strSets = section.get("sets"); if ( null != strSets ) { sets = Arrays.asList(strSets.split(", ")); @@ -345,7 +349,7 @@ public class GameFormat implements Comparable { } } - GameFormat result = new GameFormat(title, sets, bannedCards, restrictedCards, restrictedLegendary, additionalCards, rarities, idx, formatType,formatsubType); + GameFormat result = new GameFormat(title, date, sets, bannedCards, restrictedCards, restrictedLegendary, additionalCards, rarities, idx, formatType,formatsubType); naturallyOrdered.add(result); return result; } diff --git a/forge-gui/src/main/java/forge/quest/data/GameFormatQuest.java b/forge-gui/src/main/java/forge/quest/data/GameFormatQuest.java index 51c117bf1ea..6b6876dff77 100644 --- a/forge-gui/src/main/java/forge/quest/data/GameFormatQuest.java +++ b/forge-gui/src/main/java/forge/quest/data/GameFormatQuest.java @@ -62,7 +62,7 @@ public final class GameFormatQuest extends GameFormat { * @param allowSetUnlocks */ public GameFormatQuest(final GameFormat toCopy, boolean allowSetUnlocks) { - super(toCopy.getName(), toCopy.getAllowedSetCodes(), toCopy.getBannedCardNames(), toCopy.getRestrictedCards(), + super(toCopy.getName(), toCopy.getEffectiveDate(), toCopy.getAllowedSetCodes(), toCopy.getBannedCardNames(), toCopy.getRestrictedCards(), toCopy.isRestrictedLegendary(),toCopy.getAdditionalCards(), toCopy.getAllowedRarities(), toCopy.getIndex(), FormatType.Custom, FormatSubType.Custom); allowUnlocks = allowSetUnlocks;