* Fixed Standard Format selection. Client used fixed date. Check on deck validator used wrong month (1.11 insted of 1.10).

This commit is contained in:
LevelX2 2014-10-02 16:59:25 +02:00
parent 96d2351d09
commit 140ffb256a
2 changed files with 22 additions and 6 deletions

View file

@ -1,11 +1,15 @@
package mage.client.util.sets; package mage.client.util.sets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;
import mage.cards.repository.ExpansionInfo; import mage.cards.repository.ExpansionInfo;
import mage.cards.repository.ExpansionRepository; import mage.cards.repository.ExpansionRepository;
import mage.constants.SetType; import mage.constants.SetType;
import java.util.*;
/** /**
* Utility class for constructed formats (expansions and other editions). * Utility class for constructed formats (expansions and other editions).
* *
@ -13,6 +17,9 @@ import java.util.*;
*/ */
public class ConstructedFormats { public class ConstructedFormats {
private static GregorianCalendar calendar = new GregorianCalendar();
public static final String ALL = "- All Sets"; public static final String ALL = "- All Sets";
public static final String STANDARD = "- Standard"; public static final String STANDARD = "- Standard";
public static final String EXTENDED = "- Extended"; public static final String EXTENDED = "- Extended";
@ -489,9 +496,18 @@ public class ConstructedFormats {
} }
private static void buildLists() { private static void buildLists() {
GregorianCalendar cutoff;
// month is zero based so January = 0
if (calendar.get(Calendar.MONTH) > 8) {
cutoff = new GregorianCalendar(calendar.get(Calendar.YEAR) - 1, Calendar.SEPTEMBER, 1);
}
else {
cutoff = new GregorianCalendar(calendar.get(Calendar.YEAR) - 2, Calendar.SEPTEMBER, 1);
}
for (ExpansionInfo set : ExpansionRepository.instance.getAll()) { for (ExpansionInfo set : ExpansionRepository.instance.getAll()) {
if (!set.getType().equals(SetType.REPRINT) && !set.getType().equals(SetType.JOKESET)) { if (!set.getType().equals(SetType.REPRINT) && !set.getType().equals(SetType.JOKESET)) {
if (set.getReleaseDate().after(standardDate)) { if (set.getReleaseDate().after(cutoff.getTime())) {
standard.add(set.getCode()); standard.add(set.getCode());
} }
if (set.getReleaseDate().after(extendedDate)) { if (set.getReleaseDate().after(extendedDate)) {
@ -505,7 +521,6 @@ public class ConstructedFormats {
} }
private static final List<String> standard = new ArrayList<>(); private static final List<String> standard = new ArrayList<>();
private static final Date standardDate = new GregorianCalendar(2012, 9, 28).getTime();
private static final List<String> extended = new ArrayList<>(); private static final List<String> extended = new ArrayList<>();
private static final Date extendedDate = new GregorianCalendar(2009, 8, 20).getTime(); private static final Date extendedDate = new GregorianCalendar(2009, 8, 20).getTime();

View file

@ -46,7 +46,8 @@ public class Standard extends Constructed {
super("Constructed - Standard"); super("Constructed - Standard");
GregorianCalendar current = new GregorianCalendar(); GregorianCalendar current = new GregorianCalendar();
GregorianCalendar cutoff; GregorianCalendar cutoff;
if (current.get(Calendar.MONTH) > 9) { // month is zero based so January = 0
if (current.get(Calendar.MONTH) > 8) {
cutoff = new GregorianCalendar(current.get(Calendar.YEAR) - 1, Calendar.SEPTEMBER, 1); cutoff = new GregorianCalendar(current.get(Calendar.YEAR) - 1, Calendar.SEPTEMBER, 1);
} }
else { else {