Merge pull request #953 from ImperatorPrime/master

Clean up sets.
This commit is contained in:
LevelX2 2015-05-04 08:13:18 +02:00
commit c5c51cacf0
52 changed files with 306 additions and 667 deletions

View file

@ -420,7 +420,7 @@ public class DeckGenerator {
if (landSets.isEmpty()) {
for (String setCode :setsToUse) {
ExpansionInfo expansionInfo = ExpansionRepository.instance.getSetByCode(setCode);
ExpansionInfo [] blockSets = ExpansionRepository.instance.getSetsFromBlock(expansionInfo.getBlockName());
List<ExpansionInfo> blockSets = ExpansionRepository.instance.getSetsFromBlock(expansionInfo.getBlockName());
for (ExpansionInfo blockSet: blockSets) {
if (blockSet.hasBasicLands()) {
landSets.add(blockSet.getCode());

View file

@ -91,7 +91,7 @@ public final class CollectionViewerPanel extends JPanel {
label1.setForeground(Color.white);
jPanel1.add(label1);
formats = new JComboBox(ConstructedFormats.getTypes());
formats = new JComboBox<>(ConstructedFormats.getTypes());
formats.setSelectedItem(ConstructedFormats.getDefault());
formats.setPreferredSize(new Dimension(250, 25));
formats.setMaximumSize(new Dimension(250, 25));

View file

@ -76,7 +76,7 @@ public class AddLandDialog extends MageDialog {
for (String setCode :deck.getExpansionSetCodes()) {
ExpansionInfo expansionInfo = ExpansionRepository.instance.getSetByCode(setCode);
if (expansionInfo != null) {
ExpansionInfo [] blockSets = ExpansionRepository.instance.getSetsFromBlock(expansionInfo.getBlockName());
List<ExpansionInfo> blockSets = ExpansionRepository.instance.getSetsFromBlock(expansionInfo.getBlockName());
for (ExpansionInfo blockSet: blockSets) {
if (blockSet.hasBasicLands()) {
this.setCodesland.add(blockSet.getCode());

View file

@ -1,11 +1,15 @@
package mage.client.util.sets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import mage.cards.repository.ExpansionInfo;
import mage.cards.repository.ExpansionRepository;
import mage.constants.SetType;
@ -19,598 +23,31 @@ public class ConstructedFormats {
private static final GregorianCalendar calendar = new GregorianCalendar();
public static final String ALL = "- All Sets";
public static final String STANDARD = "- Standard";
public static final String EXTENDED = "- Extended";
public static final String MODERN = "- Modern";
private static final String[] constructedFormats = {
ALL, STANDARD, EXTENDED, MODERN,
"* Khans of Tarkir Block", "Khans of Tarkir", "Fate Reforged", "Dragons of Tarkir",
"* Theros Block", "Theros", "Born of the Gods", "Journey into Nyx",
"* Return to Ravnica Block", "Return to Ravnica", "Gatecrash", "Dragon's Maze",
"* Innistrad Block", "Innistrad", "Dark Ascension", "Avacyn Restored",
"* Scars of Mirrodin Block", "Scars of Mirrodin", "Mirrodin Besieged", "New Phyrexia",
"* Zendikar Block", "Zendikar", "Worldwake", "Rise of the Eldrazi",
"* Shards of Alara Block", "Shards of Alara", "Conflux", "Alara Reborn",
"* Shadowmoor Block", "Shadowmoor", "Eventide",
"* Lorwyn Block", "Lorwyn", "Morningtide",
"* Time Spiral Block", "Time Spiral", "Planar Chaos", "Future Sight",
"* Ravnica Block", "Ravnica: City of Guilds", "Guildpact", "Dissension",
"* Kamigawa Block", "Champions of Kamigawa", "Betrayers of Kamigawa", "Saviors of Kamigawa",
"* Mirrodin Block", "Mirrodin", "Darksteel", "Fifth Dawn",
"* Onslaught Block", "Onslaught", "Legions", "Scourge",
"* Odyssey Block", "Odyssey", "Torment", "Judgment",
"* Invasion Block", "Invasion", "Planeshift", "Apocalypse",
"* Masquerade Block", "Mercadian Masques", "Nemesis", "Prophecy",
"* Urza Block", "Urza's Saga", "Urza's Legacy", "Urza's Destiny",
"* Tempest Block", "Tempest", "Stronghold", "Exodus",
"* Mirage Block", "Mirage", "Visions", "Weatherlight",
"* Ice Age Block", "Ice Age", "Alliances", "Coldsnap",
"Homelands", "Fallen Empires", "The Dark", "Legends", "Antiquities", "Arabian Nights",
"Magic Origins",
"Magic 2015",
"Magic 2014",
"Magic 2013",
"Magic 2012",
"Magic 2011",
"Magic 2010",
"Tenth Edition",
"Ninth Edition",
"Eighth Edition",
"Seventh Edition",
"Sixth Edition",
"Fifth Edition",
"Fourth Edition",
"Revised Edition", "Unlimited Edition", "Limited Edition Beta", "Limited Edition Alpha",
"Tempest Remastered",
"Vintage Masters",
"Conspiracy",
"Modern Masters 2015",
"Modern Masters",
"Masters Edition",
"Masters Edition II",
"Masters Edition III",
"Masters Edition IV",
"Archenemy",
"Commander 2014 Edition",
"Commander 2013 Edition",
"Commander",
"Planechase 2012",
"Planechase",
"Portal", "Portal Second Age", "Portal Three Kingdoms","Starter 1999","Starter 2000",
"Duel Decks: Anthology, Divine vs. Demonic",
"Duel Decks: Anthology, Elves vs. Goblins",
"Duel Decks: Anthology, Garruk vs. Liliana",
"Duel Decks: Anthology, Jace vs. Chandra",
"Duel Decks: Ajani vs. Nicol Bolas",
"Duel Decks: Divine vs. Demonic",
"Duel Decks: Elspeth vs. Kiora",
"Duel Decks: Elspeth vs. Tezzeret",
"Duel Decks: Elves vs. Goblins",
"Duel Decks: Garruk vs. Liliana",
"Duel Decks: Heroes vs. Monsters",
"Duel Decks: Izzet vs. Golgari",
"Duel Decks: Jace vs. Chandra",
"Duel Decks: Jace vs. Vraska",
"Duel Decks: Knights vs. Dragons",
"Duel Decks: Phyrexia vs. the Coalition",
"Duel Decks: Sorin vs. Tibalt",
"Duel Decks: Speed vs. Cunning",
"Duel Decks: Venser vs. Koth",
"Friday Night Magic",
"Game Day",
"Grand Prix",
"Guru",
"Judge Promo",
"Launch Party",
"Media Inserts",
"Magic Player Rewards",
"Prerelease Events",
"Unhinged",
"World Magic Cup Qualifier",
"WPN Gateway",
};
private static final Map<String, List<String>> underlyingSetCodesPerFormat = new HashMap<>();
private static final List<String> formats = new ArrayList<String>();
private ConstructedFormats() {
}
public static String[] getTypes() {
return constructedFormats;
return formats.toArray(new String[0]);
}
public static String getDefault() {
return constructedFormats[1];
return STANDARD;
}
public static List<String> getSetsByFormat(String format) {
if (format.equals("* Khans of Tarkir Block")) {
return Arrays.asList("KTK", "FRF", "DTK");
}
if (format.equals("Dragons of Tarkir")) {
return Arrays.asList("DTK");
}
if (format.equals("Fate Reforged")) {
return Arrays.asList("FRF");
}
if (format.equals("Khans of Tarkir")) {
return Arrays.asList("KTK");
}
if (format.equals("* Theros Block")) {
return Arrays.asList("THS", "BNG", "JOU");
}
if (format.equals("Journey into Nyx")) {
return Arrays.asList("JOU");
}
if (format.equals("Born of the Gods")) {
return Arrays.asList("BNG");
}
if (format.equals("Theros")) {
return Arrays.asList("THS");
}
if (format.equals("Arabian Nights")) {
return Arrays.asList("ARN");
}
if (format.equals("Antiquities")) {
return Arrays.asList("ATQ");
}
if (format.equals("Legends")) {
return Arrays.asList("LEG");
}
if (format.equals("The Dark")) {
return Arrays.asList("DRK");
}
if (format.equals("Fallen Empires")) {
return Arrays.asList("FEM");
}
if (format.equals("Homelands")) {
return Arrays.asList("HML");
}
if (format.equals("* Ice Age Block")) {
return Arrays.asList("ICE", "ALL", "CSP");
}
if (format.equals("Ice Age")) {
return Arrays.asList("ICE");
}
if (format.equals("Alliances")) {
return Arrays.asList("ALL");
}
if (format.equals("Coldsnap")) {
return Arrays.asList("CSP");
}
if (format.equals("* Mirage Block")) {
return Arrays.asList("MIR", "VIS", "WTH");
}
if (format.equals("Mirage")) {
return Arrays.asList("MIR");
}
if (format.equals("Visions")) {
return Arrays.asList("VIS");
}
if (format.equals("Weatherlight")) {
return Arrays.asList("WTH");
}
if (format.equals("* Tempest Block")) {
return Arrays.asList("TMP", "STH", "EXO");
}
if (format.equals("Tempest")) {
return Arrays.asList("TMP");
}
if (format.equals("Stronghold")) {
return Arrays.asList("STH");
}
if (format.equals("Exodus")) {
return Arrays.asList("EXO");
}
if (format.equals("* Urza Block")) {
return Arrays.asList("USG", "ULG", "UDS");
}
if (format.equals("Urza's Saga")) {
return Arrays.asList("USG");
}
if (format.equals("Urza's Legacy")) {
return Arrays.asList("ULG");
}
if (format.equals("Urza's Destiny")) {
return Arrays.asList("UDS");
}
if (format.equals("* Masquerade Block")) {
return Arrays.asList("MMQ", "NMS", "PCY");
}
if (format.equals("Mercadian Masques")) {
return Arrays.asList("MMQ");
}
if (format.equals("Nemesis")) {
return Arrays.asList("NMS");
}
if (format.equals("Prophecy")) {
return Arrays.asList("PCY");
}
if (format.equals("* Invasion Block")) {
return Arrays.asList("INV", "PLS", "APC");
}
if (format.equals("Invasion")) {
return Arrays.asList("INV");
}
if (format.equals("Planeshift")) {
return Arrays.asList("PLS");
}
if (format.equals("Apocalypse")) {
return Arrays.asList("APC");
}
if (format.equals("* Odyssey Block")) {
return Arrays.asList("ODY", "TOR", "JUD");
}
if (format.equals("Odyssey")) {
return Arrays.asList("ODY");
}
if (format.equals("Torment")) {
return Arrays.asList("TOR");
}
if (format.equals("Judgment")) {
return Arrays.asList("JUD");
}
if (format.equals("* Onslaught Block")) {
return Arrays.asList("ONS", "LGN", "SCG");
}
if (format.equals("Onslaught")) {
return Arrays.asList("ONS");
}
if (format.equals("Legions")) {
return Arrays.asList("LGN");
}
if (format.equals("Scourge")) {
return Arrays.asList("SCG");
}
if (format.equals("* Mirrodin Block")) {
return Arrays.asList("MRD", "DST", "5DN");
}
if (format.equals("Mirrodin")) {
return Arrays.asList("MRD");
}
if (format.equals("Darksteel")) {
return Arrays.asList("DST");
}
if (format.equals("Fifth Dawn")) {
return Arrays.asList("5DN");
}
if (format.equals("* Kamigawa Block")) {
return Arrays.asList("CHK", "BOK", "SOK");
}
if (format.equals("Champions of Kamigawa")) {
return Arrays.asList("CHK");
}
if (format.equals("Betrayers of Kamigawa")) {
return Arrays.asList("BOK");
}
if (format.equals("Saviors of Kamigawa")) {
return Arrays.asList("SOK");
}
if (format.equals("* Ravnica Block")) {
return Arrays.asList("RAV", "GPT", "DIS");
}
if (format.equals("Ravnica: City of Guilds")) {
return Arrays.asList("RAV");
}
if (format.equals("Guildpact")) {
return Arrays.asList("GPT");
}
if (format.equals("Dissension")) {
return Arrays.asList("DIS");
}
if (format.equals("* Time Spiral Block")) {
return Arrays.asList("TSP", "TSB", "PLC", "FUT");
}
if (format.equals("Time Spiral")) {
return Arrays.asList("TSP", "TSB");
}
if (format.equals("Planar Chaos")) {
return Arrays.asList("PLC");
}
if (format.equals("Future Sight")) {
return Arrays.asList("FUT");
}
if (format.equals("* Lorwyn Block")) {
return Arrays.asList("LRW", "MOR");
}
if (format.equals("Lorwyn")) {
return Arrays.asList("LRW");
}
if (format.equals("Morningtide")) {
return Arrays.asList("MOR");
}
if (format.equals("* Shadowmoor Block")) {
return Arrays.asList("SHM", "EVE");
}
if (format.equals("Shadowmoor")) {
return Arrays.asList("SHM");
}
if (format.equals("Eventide")) {
return Arrays.asList("EVE");
}
if (format.equals("* Shards of Alara Block")) {
return Arrays.asList("ALA", "CON", "ARB");
}
if (format.equals("Alara Reborn")) {
return Arrays.asList("ARB");
}
if (format.equals("Conflux")) {
return Arrays.asList("CON");
}
if (format.equals("Shards of Alara")) {
return Arrays.asList("ALA");
}
if (format.equals("* Zendikar Block")) {
return Arrays.asList("ZEN", "WWK", "ROE");
}
if (format.equals("Zendikar")) {
return Arrays.asList("ZEN");
}
if (format.equals("Worldwake")) {
return Arrays.asList("WWK");
}
if (format.equals("Rise of the Eldrazi")) {
return Arrays.asList("ROE");
}
if (format.equals("* Scars of Mirrodin Block")) {
return Arrays.asList("SOM", "MBS", "NPH");
}
if (format.equals("Scars of Mirrodin")) {
return Arrays.asList("SOM");
}
if (format.equals("Mirrodin Besieged")) {
return Arrays.asList("MBS");
}
if (format.equals("New Phyrexia")) {
return Arrays.asList("NPH");
}
if (format.equals("* Innistrad Block")) {
return Arrays.asList("ISD", "DKA", "AVR");
}
if (format.equals("Innistrad")) {
return Arrays.asList("ISD");
}
if (format.equals("Dark Ascension")) {
return Arrays.asList("DKA");
}
if (format.equals("Avacyn Restored")) {
return Arrays.asList("AVR");
}
if (format.equals("* Return to Ravnica Block")) {
return Arrays.asList("RTR", "GTC", "DGM");
}
if (format.equals("Return to Ravnica")) {
return Arrays.asList("RTR");
}
if (format.equals("Gatecrash")) {
return Arrays.asList("GTC");
}
if (format.equals("Dragon's Maze")) {
return Arrays.asList("DGM");
}
if (format.equals("Limited Edition Alpha")) {
return Arrays.asList("LEA");
}
if (format.equals("Limited Edition Beta")) {
return Arrays.asList("LEB");
}
if (format.equals("Unlimited Edition")) {
return Arrays.asList("2ED");
}
if (format.equals("Revised Edition")) {
return Arrays.asList("3ED");
}
if (format.equals("Fourth Edition")) {
return Arrays.asList("4ED");
}
if (format.equals("Fifth Edition")) {
return Arrays.asList("5ED");
}
if (format.equals("Sixth Edition")) {
return Arrays.asList("6ED");
}
if (format.equals("Seventh Edition")) {
return Arrays.asList("7ED");
}
if (format.equals("Eighth Edition")) {
return Arrays.asList("8ED");
}
if (format.equals("Ninth Edition")) {
return Arrays.asList("9ED");
}
if (format.equals("Tenth Edition")) {
return Arrays.asList("10E");
}
if (format.equals("Magic 2010")) {
return Arrays.asList("M10");
}
if (format.equals("Magic 2011")) {
return Arrays.asList("M11");
}
if (format.equals("Magic 2012")) {
return Arrays.asList("M12");
}
if (format.equals("Magic 2013")) {
return Arrays.asList("M13");
}
if (format.equals("Magic 2014")) {
return Arrays.asList("M14");
}
if (format.equals("Magic 2015")) {
return Arrays.asList("M15");
}
if (format.equals("Magic Origins")) {
return Arrays.asList("ORI");
}
if (format.equals("Archenemy")) {
return Arrays.asList("ARC");
}
if (format.equals("Planechase")) {
return Arrays.asList("HOP");
}
if (format.equals("Commander")) {
return Arrays.asList("CMD");
}
if (format.equals("Commander 2013 Edition")) {
return Arrays.asList("C13");
}
if (format.equals("Commander 2014 Edition")) {
return Arrays.asList("C14");
}
if (format.equals("Planechase 2012")) {
return Arrays.asList("PC2");
}
if (format.equals("Tempest Remastered")) {
return Arrays.asList("TPR");
}
if (format.equals("Modern Masters")) {
return Arrays.asList("MMA");
}
if (format.equals("Modern Masters 2015")) {
return Arrays.asList("MMB");
}
if (format.equals("Masters Edition")) {
return Arrays.asList("MED");
}
if (format.equals("Masters Edition II")) {
return Arrays.asList("ME2");
}
if (format.equals("Masters Edition III")) {
return Arrays.asList("ME3");
}
if (format.equals("Masters Edition IV")) {
return Arrays.asList("ME4");
}
if (format.equals("Conspiracy")) {
return Arrays.asList("CNS");
}
if (format.equals("Vintage Masters")) {
return Arrays.asList("VMA");
}
if (format.equals("Friday Night Magic")) {
return Arrays.asList("FNMP");
}
if (format.equals("Game Day")) {
return Arrays.asList("MGDC");
}
if (format.equals("Grand Prix")) {
return Arrays.asList("GPX");
}
if (format.equals("Launch Party")) {
return Arrays.asList("MLP");
}
if (format.equals("Magic Player Rewards")) {
return Arrays.asList("MPRP");
}
if (format.equals("Media Inserts")) {
return Arrays.asList("MBP");
}
if (format.equals("Prerelease Events")) {
return Arrays.asList("PTC");
}
if (format.equals("World Magic Cup Qualifier")) {
return Arrays.asList("WMCQ");
}
if (format.equals("WPN Gateway")) {
return Arrays.asList("GRC");
}
if (format.equals("Guru")) {
return Arrays.asList("GUR");
}
if (format.equals("Judge Promo")) {
return Arrays.asList("JR");
}
if (format.equals("Unhinged")) {
return Arrays.asList("UNH");
}
if (format.equals("Portal")) {
return Arrays.asList("POR");
}
if (format.equals("Portal Second Age")) {
return Arrays.asList("PO2");
}
if (format.equals("Portal Three Kingdoms")) {
return Arrays.asList("PTK");
}
if (format.equals("Starter 1999")) {
return Arrays.asList("S99");
}
if (format.equals("Starter 2000")) {
return Arrays.asList("S00");
}
if (format.equals("Duel Decks: Anthology, Divine vs. Demonic")) {
return Arrays.asList("DD3A");
}
if (format.equals("Duel Decks: Anthology, Elves vs. Goblins")) {
return Arrays.asList("DD3B");
}
if (format.equals("Duel Decks: Anthology, Garruk vs. Liliana")) {
return Arrays.asList("DD3C");
}
if (format.equals("Duel Decks: Anthology, Jace vs. Chandra")) {
return Arrays.asList("DD3D");
}
if (format.equals("Duel Decks: Elves vs. Goblins")) {
return Arrays.asList("EVG");
}
if (format.equals("Duel Decks: Jace vs. Chandra")) {
return Arrays.asList("DD2");
}
if (format.equals("Duel Decks: Divine vs. Demonic")) {
return Arrays.asList("DDC");
}
if (format.equals("Duel Decks: Garruk vs. Liliana")) {
return Arrays.asList("DDD");
}
if (format.equals("Duel Decks: Phyrexia vs. the Coalition")) {
return Arrays.asList("DDE");
}
if (format.equals("Duel Decks: Elspeth vs. Kiora")) {
return Arrays.asList("DDO");
}
if (format.equals("Duel Decks: Elspeth vs. Tezzeret")) {
return Arrays.asList("DDF");
}
if (format.equals("Duel Decks: Knights vs. Dragons")) {
return Arrays.asList("DDG");
}
if (format.equals("Duel Decks: Ajani vs. Nicol Bolas")) {
return Arrays.asList("DDH");
}
if (format.equals("Duel Decks: Venser vs. Koth")) {
return Arrays.asList("DDI");
}
if (format.equals("Duel Decks: Izzet vs. Golgari")) {
return Arrays.asList("DDJ");
}
if (format.equals("Duel Decks: Sorin vs. Tibalt")) {
return Arrays.asList("DDK");
}
if (format.equals("Duel Decks: Heroes vs. Monsters")) {
return Arrays.asList("DDL");
}
if (format.equals("Duel Decks: Jace vs. Vraska")) {
return Arrays.asList("DDM");
}
if (format.equals("Duel Decks: Speed vs. Cunning")) {
return Arrays.asList("DDN");
}
if (format.equals(STANDARD)) {
return standard;
}
if (format.equals(EXTENDED)) {
return extended;
}
if (format.equals(MODERN)) {
return modern;
public static List<String> getSetsByFormat(final String format) {
if(!format.equals(ALL)) {
return underlyingSetCodesPerFormat.get(format);
}
return all;
}
private static void buildLists() {
@ -622,28 +59,171 @@ public class ConstructedFormats {
else {
cutoff = new GregorianCalendar(calendar.get(Calendar.YEAR) - 2, Calendar.SEPTEMBER, 1);
}
final Map<String, ExpansionInfo> expansionInfo = new HashMap<String, ExpansionInfo>();
for (ExpansionInfo set : ExpansionRepository.instance.getAll()) {
expansionInfo.put(set.getName(), set);
formats.add(set.getName());
if (set.getType().equals(SetType.CORE) || set.getType().equals(SetType.EXPANSION)) {
if (set.getReleaseDate().after(cutoff.getTime())) {
standard.add(set.getCode());
if(underlyingSetCodesPerFormat.get(STANDARD) == null) {
underlyingSetCodesPerFormat.put(STANDARD, new ArrayList<String>());
}
underlyingSetCodesPerFormat.get(STANDARD).add(set.getCode());
}
if (set.getReleaseDate().after(extendedDate)) {
extended.add(set.getCode());
if(underlyingSetCodesPerFormat.get(EXTENDED) == null) {
underlyingSetCodesPerFormat.put(EXTENDED, new ArrayList<String>());
}
underlyingSetCodesPerFormat.get(EXTENDED).add(set.getCode());
}
if (set.getReleaseDate().after(modernDate)) {
modern.add(set.getCode());
if(underlyingSetCodesPerFormat.get(MODERN) == null) {
underlyingSetCodesPerFormat.put(MODERN, new ArrayList<String>());
}
underlyingSetCodesPerFormat.get(MODERN).add(set.getCode());
}
}
if(underlyingSetCodesPerFormat.get(set.getName()) == null) {
underlyingSetCodesPerFormat.put(set.getName(), new ArrayList<String>());
}
underlyingSetCodesPerFormat.get(set.getName()).add(set.getCode());
if(set.getType().equals(SetType.EXPANSION) && set.getBlockName() != null) {
String blockDisplayName = getBlockDisplayName(set.getBlockName());
if(underlyingSetCodesPerFormat.get(blockDisplayName) == null) {
underlyingSetCodesPerFormat.put(blockDisplayName, new ArrayList<String>());
}
underlyingSetCodesPerFormat.get(blockDisplayName).add(set.getCode());
if(expansionInfo.get(blockDisplayName) == null) {
expansionInfo.put(blockDisplayName, set);
formats.add(blockDisplayName);
}
if(expansionInfo.get(blockDisplayName).getReleaseDate().after(set.getReleaseDate())) {
expansionInfo.put(blockDisplayName, set);
}
}
if(set.getType().equals(SetType.SUPPLEMENTAL) && set.getBlockName() != null) {
if(expansionInfo.get(set.getBlockName()) == null) {
expansionInfo.put(set.getBlockName(), set);
}
if(expansionInfo.get(set.getBlockName()).getReleaseDate().before(set.getReleaseDate())) {
expansionInfo.put(set.getBlockName(), set);
}
}
}
private static final List<String> standard = new ArrayList<>();
Collections.sort(formats, new Comparator<String>() {
@Override
public int compare(String name1, String name2) {
ExpansionInfo expansionInfo1 = expansionInfo.get(name1);
ExpansionInfo expansionInfo2 = expansionInfo.get(name2);
if(expansionInfo1.getType().compareTo(expansionInfo2.getType()) == 0) {
SetType setType = expansionInfo1.getType();
if(setType.equals(SetType.EXPANSION)) {
if(expansionInfo1.getBlockName() == null) {
if(expansionInfo2.getBlockName() == null) {
return expansionInfo2.getReleaseDate().compareTo(expansionInfo1.getReleaseDate());
}
return 1;
}
if(expansionInfo2.getBlockName() == null) {
return -1;
}
//Block comparison
if(name1.endsWith("Block") && name2.endsWith("Block")) {
return expansionInfo2.getReleaseDate().compareTo(expansionInfo1.getReleaseDate());
}
if(name1.endsWith("Block")) {
if(expansionInfo1.getBlockName().equals(expansionInfo2.getBlockName())) {
return -1;
}
}
if(name2.endsWith("Block")) {
if(expansionInfo1.getBlockName().equals(expansionInfo2.getBlockName())) {
return 1;
}
}
return expansionInfo2.getReleaseDate().compareTo(expansionInfo1.getReleaseDate());
} else if(setType.equals(SetType.SUPPLEMENTAL)) {
if(expansionInfo1.getBlockName() == null) {
if(expansionInfo2.getBlockName() == null) {
return expansionInfo2.getReleaseDate().compareTo(expansionInfo1.getReleaseDate());
}
return -1;
}
if(expansionInfo2.getBlockName() == null) {
return 1;
}
if(expansionInfo1.getBlockName().equals(expansionInfo2.getBlockName())) {
//If release date is the same, sort alphabetically.
if(expansionInfo2.getReleaseDate().compareTo(expansionInfo1.getReleaseDate()) == 0) {
return name1.compareTo(name2);
}
return expansionInfo2.getReleaseDate().compareTo(expansionInfo1.getReleaseDate());
}
if(expansionInfo1.getBlockName().startsWith("Duel Decks")) {
if(expansionInfo1.getBlockName().startsWith("Duel Decks: Anthology")) {
return 1;
}
return 1;
}
if(expansionInfo2.getBlockName().startsWith("Duel Decks")) {
return -1;
}
ExpansionInfo blockInfo1 = expansionInfo.get(expansionInfo1.getBlockName());
ExpansionInfo blockInfo2 = expansionInfo.get(expansionInfo2.getBlockName());
return blockInfo2.getReleaseDate().compareTo(blockInfo1.getReleaseDate());
} else {
return expansionInfo2.getReleaseDate().compareTo(expansionInfo1.getReleaseDate());
}
}
return expansionInfo1.getType().compareTo(expansionInfo2.getType());
}
});
formats.add(0, MODERN);
formats.add(0, EXTENDED);
formats.add(0, STANDARD);
formats.add(0, ALL);
}
private static String getBlockDisplayName(String blockName) {
StringBuilder builder = new StringBuilder();
builder.append("* ").append(blockName).append(" Block");
return builder.toString();
}
private static final List<String> extended = new ArrayList<>();
private static final Date extendedDate = new GregorianCalendar(2009, 8, 20).getTime();
private static final List<String> modern = new ArrayList<>();
private static final Date modernDate = new GregorianCalendar(2003, 7, 20).getTime();
// for all sets just return empty list

View file

@ -34,10 +34,10 @@ import mage.cards.decks.Constructed;
*
* @author BetaSteward_at_googlemail.com
*/
public class ShadowmooreBlock extends Constructed {
public class ShadowmoorBlock extends Constructed {
public ShadowmooreBlock() {
super("Constructed - Shadowmoore Block");
public ShadowmoorBlock() {
super("Constructed - Shadowmoor Block");
setCodes.add("SHM");
setCodes.add("EVE");
}

View file

@ -1549,7 +1549,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
if (landSets.isEmpty()) {
for (String setCode :deck.getExpansionSetCodes()) {
ExpansionInfo expansionInfo = ExpansionRepository.instance.getSetByCode(setCode);
ExpansionInfo [] blockSets = ExpansionRepository.instance.getSetsFromBlock(expansionInfo.getBlockName());
List<ExpansionInfo> blockSets = ExpansionRepository.instance.getSetsFromBlock(expansionInfo.getBlockName());
for (ExpansionInfo blockSet: blockSets) {
if (blockSet.hasBasicLands()) {
landSets.add(blockSet.getCode());

View file

@ -44,7 +44,8 @@ public class AjaniVsNicolBolas extends ExpansionSet {
}
private AjaniVsNicolBolas() {
super("Duel Decks: Ajani vs. Nicol Bolas", "DDH", "mage.sets.ajanivsnicolbolas", new GregorianCalendar(2011, 9, 2).getTime(), SetType.DUEL_DECK);
super("Duel Decks: Ajani vs. Nicol Bolas", "DDH", "mage.sets.ajanivsnicolbolas", new GregorianCalendar(2011, 9, 2).getTime(), SetType.SUPPLEMENTAL);
this.blockName = "Duel Decks";
this.hasBasicLands = false;
}
}

View file

@ -43,7 +43,8 @@ public class AnthologyDivineVsDemonic extends ExpansionSet {
}
private AnthologyDivineVsDemonic() {
super("Duel Decks: Anthology, Divine vs. Demonic", "DD3A", "mage.sets.anthologydivinevsdemonic", new GregorianCalendar(2014, 12, 5).getTime(), SetType.DUEL_DECK);
super("Duel Decks: Anthology, Divine vs. Demonic", "DD3A", "mage.sets.anthologydivinevsdemonic", new GregorianCalendar(2014, 12, 5).getTime(), SetType.SUPPLEMENTAL);
this.blockName = "Duel Decks: Anthology";
this.hasBasicLands = false;
}
}

View file

@ -43,7 +43,8 @@ public class AnthologyElvesVsGoblins extends ExpansionSet {
}
private AnthologyElvesVsGoblins() {
super("Duel Decks: Anthology, Elves vs. Goblins", "DD3B", "mage.sets.anthologyelvesvsgoblins", new GregorianCalendar(2014, 12, 5).getTime(), SetType.DUEL_DECK);
super("Duel Decks: Anthology, Elves vs. Goblins", "DD3B", "mage.sets.anthologyelvesvsgoblins", new GregorianCalendar(2014, 12, 5).getTime(), SetType.SUPPLEMENTAL);
this.blockName = "Duel Decks: Anthology";
this.hasBasicLands = false;
}
}

View file

@ -43,7 +43,8 @@ public class AnthologyGarrukVsLiliana extends ExpansionSet {
}
private AnthologyGarrukVsLiliana() {
super("Duel Decks: Anthology, Garruk vs. Liliana", "DD3C", "mage.sets.anthologygarrukvsliliana", new GregorianCalendar(2014, 12, 5).getTime(), SetType.DUEL_DECK);
super("Duel Decks: Anthology, Garruk vs. Liliana", "DD3C", "mage.sets.anthologygarrukvsliliana", new GregorianCalendar(2014, 12, 5).getTime(), SetType.SUPPLEMENTAL);
this.blockName = "Duel Decks: Anthology";
this.hasBasicLands = false;
}
}

View file

@ -43,7 +43,8 @@ public class AnthologyJaceVsChandra extends ExpansionSet {
}
private AnthologyJaceVsChandra() {
super("Duel Decks: Anthology, Jace vs. Chandra", "DD3D", "mage.sets.anthologyjacevschandra", new GregorianCalendar(2014, 12, 5).getTime(), SetType.DUEL_DECK);
super("Duel Decks: Anthology, Jace vs. Chandra", "DD3D", "mage.sets.anthologyjacevschandra", new GregorianCalendar(2014, 12, 5).getTime(), SetType.SUPPLEMENTAL);
this.blockName = "Duel Decks: Anthology";
this.hasBasicLands = false;
}
}

View file

@ -45,7 +45,8 @@ public class Archenemy extends ExpansionSet {
}
private Archenemy() {
super("Archenemy", "ARC", "mage.sets.archenemy", new GregorianCalendar(2010, 6, 18).getTime(), SetType.NON_STANDARD_LEGAL_SETS);
super("Archenemy", "ARC", "mage.sets.archenemy", new GregorianCalendar(2010, 6, 18).getTime(), SetType.SUPPLEMENTAL);
this.blockName = "Command Zone";
}
}

View file

@ -36,16 +36,16 @@ import mage.constants.SetType;
*
* @author North
*/
public class SixthEdition extends ExpansionSet {
public class ClassicSixthEdition extends ExpansionSet {
private static final SixthEdition fINSTANCE = new SixthEdition();
private static final ClassicSixthEdition fINSTANCE = new ClassicSixthEdition();
public static SixthEdition getInstance() {
public static ClassicSixthEdition getInstance() {
return fINSTANCE;
}
private SixthEdition() {
super("Sixth Edition", "6ED", "mage.sets.sixthedition", new GregorianCalendar(1999, 3, 28).getTime(), SetType.CORE);
private ClassicSixthEdition() {
super("Classic Sixth Edition", "6ED", "mage.sets.classicsixthedition", new GregorianCalendar(1999, 3, 28).getTime(), SetType.CORE);
this.hasBoosters = true;
this.numBoosterLands = 1;
this.numBoosterCommon = 10;

View file

@ -47,7 +47,8 @@ public class Commander extends ExpansionSet {
}
private Commander() {
super("Magic: The Gathering-Commander", "CMD", "mage.sets.commander", new GregorianCalendar(2011, 6, 17).getTime(), SetType.NON_STANDARD_LEGAL_SETS);
super("Commander", "CMD", "mage.sets.commander", new GregorianCalendar(2011, 6, 17).getTime(), SetType.SUPPLEMENTAL);
this.blockName = "Command Zone";
}
}

View file

@ -47,7 +47,8 @@ public class Commander2013 extends ExpansionSet {
}
private Commander2013() {
super("Commander 2013 Edition", "C13", "mage.sets.commander2013", new GregorianCalendar(2013, 11, 01).getTime(), SetType.NON_STANDARD_LEGAL_SETS);
super("Commander 2013 Edition", "C13", "mage.sets.commander2013", new GregorianCalendar(2013, 11, 01).getTime(), SetType.SUPPLEMENTAL);
this.blockName = "Command Zone";
}
}

View file

@ -45,7 +45,8 @@ public class Commander2014 extends ExpansionSet {
}
private Commander2014() {
super("Commander 2014 Edition", "C14", "mage.sets.commander2014", new GregorianCalendar(2014, 11, 07).getTime(), SetType.NON_STANDARD_LEGAL_SETS);
super("Commander 2014 Edition", "C14", "mage.sets.commander2014", new GregorianCalendar(2014, 11, 07).getTime(), SetType.SUPPLEMENTAL);
this.blockName = "Command Zone";
}
}

View file

@ -47,7 +47,8 @@ import mage.constants.SetType;
}
private Conspiracy() {
super("Magic: The Gathering-Conspiracy", "CNS", "mage.sets.conspiracy", new GregorianCalendar(2014, 6, 6).getTime(), SetType.NON_STANDARD_LEGAL_SETS);
super("Conspiracy", "CNS", "mage.sets.conspiracy", new GregorianCalendar(2014, 6, 6).getTime(), SetType.SUPPLEMENTAL);
this.blockName = "Conspiracy";
this.hasBasicLands = false;
this.hasBoosters = true;
this.numBoosterLands = 0;

View file

@ -45,7 +45,8 @@ public class DivineVsDemonic extends ExpansionSet {
}
private DivineVsDemonic() {
super("Duel Decks: Divine vs. Demonic", "DDC", "mage.sets.divinevsdemonic", new GregorianCalendar(2009, 04, 10).getTime(), SetType.DUEL_DECK);
super("Duel Decks: Divine vs. Demonic", "DDC", "mage.sets.divinevsdemonic", new GregorianCalendar(2009, 04, 10).getTime(), SetType.SUPPLEMENTAL);
this.blockName = "Duel Decks";
this.hasBasicLands = false;
}
}

View file

@ -47,7 +47,7 @@ public class DragonsOfTarkir extends ExpansionSet {
private DragonsOfTarkir() {
super("Dragons of Tarkir", "DTK", "mage.sets.dragonsoftarkir", new GregorianCalendar(2015, 3, 27).getTime(), SetType.EXPANSION);
this.blockName = "Dragons of Tarkir";
this.blockName = "Khans of Tarkir";
this.hasBoosters = true;
this.hasBasicLands = true;
this.numBoosterLands = 1;

View file

@ -43,7 +43,8 @@ public class ElspethVsKiora extends ExpansionSet {
}
private ElspethVsKiora() {
super("Duel Decks: Elspeth vs. Kiora", "DDO", "mage.sets.elspethvskiora", new GregorianCalendar(2015, 2, 27).getTime(), SetType.DUEL_DECK);
super("Duel Decks: Elspeth vs. Kiora", "DDO", "mage.sets.elspethvskiora", new GregorianCalendar(2015, 2, 27).getTime(), SetType.SUPPLEMENTAL);
this.blockName = "Duel Decks";
this.hasBasicLands = false;
}
}

View file

@ -5,15 +5,16 @@ import mage.constants.SetType;
import java.util.GregorianCalendar;
public class ElspethvsTezzeret extends ExpansionSet {
private static final ElspethvsTezzeret fINSTANCE = new ElspethvsTezzeret();
public class ElspethVsTezzeret extends ExpansionSet {
private static final ElspethVsTezzeret fINSTANCE = new ElspethVsTezzeret();
public static ElspethvsTezzeret getInstance() {
public static ElspethVsTezzeret getInstance() {
return fINSTANCE;
}
private ElspethvsTezzeret() {
super("Duel Decks: Elspeth vs. Tezzeret", "DDF", "mage.sets.elspethvstezzeret", new GregorianCalendar(2010, 8, 3).getTime(), SetType.DUEL_DECK);
private ElspethVsTezzeret() {
super("Duel Decks: Elspeth vs. Tezzeret", "DDF", "mage.sets.elspethvstezzeret", new GregorianCalendar(2010, 8, 3).getTime(), SetType.SUPPLEMENTAL);
this.blockName = "Duel Decks";
this.hasBasicLands = false;
}
}

View file

@ -23,7 +23,8 @@ public class ElvesVsGoblins extends ExpansionSet {
}
private ElvesVsGoblins() {
super("Duel Decks: Elves vs. Goblins", "EVG", "mage.sets.elvesvsgoblins", new GregorianCalendar(2007, 11, 16).getTime(), SetType.DUEL_DECK);
super("Duel Decks: Elves vs. Goblins", "EVG", "mage.sets.elvesvsgoblins", new GregorianCalendar(2007, 11, 16).getTime(), SetType.SUPPLEMENTAL);
this.blockName = "Duel Decks";
this.hasBasicLands = false;
}
}

View file

@ -23,7 +23,8 @@ public class GarrukVsLiliana extends ExpansionSet {
}
private GarrukVsLiliana() {
super("Duel Decks: Garruk vs. Liliana", "DDD", "mage.sets.garrukvsliliana", new GregorianCalendar(2009, 10, 30).getTime(), SetType.DUEL_DECK);
super("Duel Decks: Garruk vs. Liliana", "DDD", "mage.sets.garrukvsliliana", new GregorianCalendar(2009, 10, 30).getTime(), SetType.SUPPLEMENTAL);
this.blockName = "Duel Decks";
this.hasBasicLands = false;
}
}

View file

@ -36,15 +36,16 @@ import mage.constants.SetType;
* @author LevelX2
*/
public class Heroesvsmonsters extends ExpansionSet {
private static final Heroesvsmonsters fINSTANCE = new Heroesvsmonsters();
public class HeroesVsMonsters extends ExpansionSet {
private static final HeroesVsMonsters fINSTANCE = new HeroesVsMonsters();
public static Heroesvsmonsters getInstance() {
public static HeroesVsMonsters getInstance() {
return fINSTANCE;
}
private Heroesvsmonsters() {
super("Duel Decks: Heroes vs. Monsters", "DDL", "mage.sets.heroesvsmonsters", new GregorianCalendar(2013, 9, 6).getTime(), SetType.DUEL_DECK);
private HeroesVsMonsters() {
super("Duel Decks: Heroes vs. Monsters", "DDL", "mage.sets.heroesvsmonsters", new GregorianCalendar(2013, 9, 6).getTime(), SetType.SUPPLEMENTAL);
this.blockName = "Duel Decks";
this.hasBasicLands = false;
}
}

View file

@ -44,7 +44,8 @@ public class IzzetVsGolgari extends ExpansionSet {
}
private IzzetVsGolgari() {
super("Duel Decks: Izzet vs. Golgari", "DDJ", "mage.sets.izzetvsgolgari", new GregorianCalendar(2012, 9, 7).getTime(), SetType.DUEL_DECK);
super("Duel Decks: Izzet vs. Golgari", "DDJ", "mage.sets.izzetvsgolgari", new GregorianCalendar(2012, 9, 7).getTime(), SetType.SUPPLEMENTAL);
this.blockName = "Duel Decks";
this.hasBasicLands = false;
}
}

View file

@ -23,7 +23,8 @@ public class JaceVsChandra extends ExpansionSet {
}
private JaceVsChandra() {
super("Duel Decks: Jace vs. Chandra", "DD2", "mage.sets.jacevschandra", new GregorianCalendar(2008, 11, 07).getTime(), SetType.DUEL_DECK);
super("Duel Decks: Jace vs. Chandra", "DD2", "mage.sets.jacevschandra", new GregorianCalendar(2008, 11, 07).getTime(), SetType.SUPPLEMENTAL);
this.blockName = "Duel Decks";
this.hasBasicLands = false;
}
}

View file

@ -45,7 +45,8 @@ public class JaceVsVraska extends ExpansionSet {
}
private JaceVsVraska() {
super("Duel Decks: Jace vs. Vraska", "DDM", "mage.sets.jacevsvraska", new GregorianCalendar(2014, 3, 14).getTime(), SetType.DUEL_DECK);
super("Duel Decks: Jace vs. Vraska", "DDM", "mage.sets.jacevsvraska", new GregorianCalendar(2014, 3, 14).getTime(), SetType.SUPPLEMENTAL);
this.blockName = "Duel Decks";
this.hasBasicLands = false;
}
}

View file

@ -45,7 +45,8 @@ public class KnightsVsDragons extends ExpansionSet {
}
private KnightsVsDragons() {
super("Duel Decks: Knights vs. Dragons", "DDG", "mage.sets.knightsvsdragons", new GregorianCalendar(2011, 4, 1).getTime(), SetType.DUEL_DECK);
super("Duel Decks: Knights vs. Dragons", "DDG", "mage.sets.knightsvsdragons", new GregorianCalendar(2011, 4, 1).getTime(), SetType.SUPPLEMENTAL);
this.blockName = "Duel Decks";
this.hasBasicLands = false;
}
}

View file

@ -44,7 +44,7 @@ public class MastersEdition extends ExpansionSet {
}
private MastersEdition() {
super("Masters Edition", "MED", "mage.sets.mastersedition", new GregorianCalendar(2007, 9, 10).getTime(), SetType.REPRINT);
super("Masters Edition", "MED", "mage.sets.mastersedition", new GregorianCalendar(2007, 9, 10).getTime(), SetType.MAGIC_ONLINE);
this.hasBasicLands = true;
this.hasBoosters = true;
this.numBoosterLands = 1;

View file

@ -44,7 +44,7 @@ public class MastersEditionII extends ExpansionSet {
}
private MastersEditionII() {
super("Masters Edition II", "ME2", "mage.sets.masterseditionii", new GregorianCalendar(2008, 9, 22).getTime(), SetType.REPRINT);
super("Masters Edition II", "ME2", "mage.sets.masterseditionii", new GregorianCalendar(2008, 9, 22).getTime(), SetType.MAGIC_ONLINE);
this.hasBasicLands = true;
this.hasBoosters = true;
this.numBoosterLands = 1;

View file

@ -44,7 +44,7 @@ public class MastersEditionIII extends ExpansionSet {
}
private MastersEditionIII() {
super("Masters Edition III", "ME3", "mage.sets.masterseditioniii", new GregorianCalendar(2009, 9, 7).getTime(), SetType.REPRINT);
super("Masters Edition III", "ME3", "mage.sets.masterseditioniii", new GregorianCalendar(2009, 9, 7).getTime(), SetType.MAGIC_ONLINE);
this.hasBasicLands = true;
this.hasBoosters = true;
this.numBoosterLands = 1;

View file

@ -45,7 +45,7 @@ public class MastersEditionIV extends ExpansionSet {
}
private MastersEditionIV() {
super("Masters Edition IV", "ME4", "mage.sets.masterseditioniv", new GregorianCalendar(2011, 1, 10).getTime(), SetType.REPRINT);
super("Masters Edition IV", "ME4", "mage.sets.masterseditioniv", new GregorianCalendar(2011, 1, 10).getTime(), SetType.MAGIC_ONLINE);
this.hasBasicLands = true;
this.hasBoosters = true;
this.numBoosterLands = 1;

View file

@ -47,7 +47,8 @@ public class ModernMasters extends ExpansionSet {
}
private ModernMasters() {
super("Modern Masters", "MMA", "mage.sets.modernmasters", new GregorianCalendar(2013, 6, 7).getTime(), SetType.REPRINT);
super("Modern Masters", "MMA", "mage.sets.modernmasters", new GregorianCalendar(2013, 6, 7).getTime(), SetType.SUPPLEMENTAL);
this.blockName = "Reprint";
this.hasBasicLands = false;
this.hasBoosters = true;
this.numBoosterLands = 0;

View file

@ -47,7 +47,8 @@ public class ModernMasters2015 extends ExpansionSet {
}
private ModernMasters2015() {
super("Modern Masters 2015", "MMB", "mage.sets.modernmasters2015", new GregorianCalendar(2015, 5, 22).getTime(), SetType.REPRINT);
super("Modern Masters 2015", "MMB", "mage.sets.modernmasters2015", new GregorianCalendar(2015, 5, 22).getTime(), SetType.SUPPLEMENTAL);
this.blockName = "Reprint";
this.hasBasicLands = false;
this.hasBoosters = true;
this.numBoosterLands = 0;

View file

@ -44,7 +44,8 @@ public class PhyrexiaVsTheCoalition extends ExpansionSet {
}
private PhyrexiaVsTheCoalition() {
super("Duel Decks: Phyrexia vs. the Coalition", "DDE", "mage.sets.phyrexiavsthecoalition", new GregorianCalendar(2010, 3, 19).getTime(), SetType.DUEL_DECK);
super("Duel Decks: Phyrexia vs. the Coalition", "DDE", "mage.sets.phyrexiavsthecoalition", new GregorianCalendar(2010, 3, 19).getTime(), SetType.SUPPLEMENTAL);
this.blockName = "Duel Decks";
this.hasBasicLands = false;
}
}

View file

@ -45,7 +45,8 @@ public class Planechase extends ExpansionSet {
}
private Planechase() {
super("Planechase", "HOP", "mage.sets.planechase", new GregorianCalendar(2009, 8, 4).getTime(), SetType.NON_STANDARD_LEGAL_SETS);
super("Planechase", "HOP", "mage.sets.planechase", new GregorianCalendar(2009, 8, 4).getTime(), SetType.SUPPLEMENTAL);
this.blockName = "Command Zone";
}
}

View file

@ -45,7 +45,8 @@ public class Planechase2012 extends ExpansionSet {
}
private Planechase2012() {
super("Planechase (2012 Edition)", "PC2", "mage.sets.planechase2012", new GregorianCalendar(2012, 6, 1).getTime(), SetType.NON_STANDARD_LEGAL_SETS);
super("Planechase 2012 Edition", "PC2", "mage.sets.planechase2012", new GregorianCalendar(2012, 6, 1).getTime(), SetType.SUPPLEMENTAL);
this.blockName = "Command Zone";
}
}

View file

@ -50,7 +50,8 @@ public class Portal extends ExpansionSet {
}
private Portal() {
super("Portal", "POR", "mage.sets.portal", new GregorianCalendar(1997, 5, 1).getTime(), SetType.REPRINT);
super("Portal", "POR", "mage.sets.portal", new GregorianCalendar(1997, 5, 1).getTime(), SetType.SUPPLEMENTAL);
this.blockName = "Beginner";
this.hasBasicLands = true;
this.hasBoosters = true;
this.numBoosterLands = 0;

View file

@ -50,7 +50,8 @@ public class PortalSecondAge extends ExpansionSet {
}
private PortalSecondAge() {
super("Portal Second Age", "PO2", "mage.sets.portalsecondage", new GregorianCalendar(1998, 6, 24).getTime(), SetType.REPRINT);
super("Portal Second Age", "PO2", "mage.sets.portalsecondage", new GregorianCalendar(1998, 6, 24).getTime(), SetType.SUPPLEMENTAL);
this.blockName = "Beginner";
this.hasBasicLands = true;
this.hasBoosters = true;
this.numBoosterLands = 0;

View file

@ -50,7 +50,8 @@ public class PortalThreeKingdoms extends ExpansionSet {
}
private PortalThreeKingdoms() {
super("Portal Three Kingsdoms", "PTK", "mage.sets.portalthreekingdoms", new GregorianCalendar(1999, 5, 1).getTime(), SetType.REPRINT);
super("Portal Three Kingdoms", "PTK", "mage.sets.portalthreekingdoms", new GregorianCalendar(1999, 5, 1).getTime(), SetType.SUPPLEMENTAL);
this.blockName = "Beginner";
this.hasBasicLands = true;
this.hasBoosters = true;
this.numBoosterLands = 2;

View file

@ -44,7 +44,8 @@ public class SorinVsTibalt extends ExpansionSet {
}
private SorinVsTibalt() {
super("Duel Decks: Sorin vs. Tibalt", "DDK", "mage.sets.sorinvstibalt", new GregorianCalendar(2013, 3, 15).getTime(), SetType.DUEL_DECK);
super("Duel Decks: Sorin vs. Tibalt", "DDK", "mage.sets.sorinvstibalt", new GregorianCalendar(2013, 3, 15).getTime(), SetType.SUPPLEMENTAL);
this.blockName = "Duel Decks";
this.hasBasicLands = false;
}
}

View file

@ -44,7 +44,8 @@ public class SpeedVsCunning extends ExpansionSet {
}
private SpeedVsCunning() {
super("Duel Decks: Speed vs. Cunning", "DDN", "mage.sets.speedvscunning", new GregorianCalendar(2014, 9, 5).getTime(), SetType.DUEL_DECK);
super("Duel Decks: Speed vs. Cunning", "DDN", "mage.sets.speedvscunning", new GregorianCalendar(2014, 9, 5).getTime(), SetType.SUPPLEMENTAL);
this.blockName = "Duel Decks";
this.hasBasicLands = false;
}
}

View file

@ -50,7 +50,8 @@ public class Starter1999 extends ExpansionSet {
}
private Starter1999() {
super("Starter1999", "S99", "mage.sets.starter1999", new GregorianCalendar(1999, 7, 1).getTime(), SetType.REPRINT);
super("Starter 1999", "S99", "mage.sets.starter1999", new GregorianCalendar(1999, 7, 1).getTime(), SetType.SUPPLEMENTAL);
this.blockName = "Beginner";
this.hasBasicLands = true;
this.hasBoosters = true;
this.numBoosterLands = 1;

View file

@ -50,7 +50,8 @@ public class Starter2000 extends ExpansionSet {
}
private Starter2000() {
super("Starter2000", "S00", "mage.sets.starter2000", new GregorianCalendar(2000, 7, 1).getTime(), SetType.REPRINT);
super("Starter 2000", "S00", "mage.sets.starter2000", new GregorianCalendar(2000, 7, 1).getTime(), SetType.SUPPLEMENTAL);
this.blockName = "Beginner";
this.hasBasicLands = true;
this.hasBoosters = false;
this.numBoosterLands = 1;

View file

@ -45,7 +45,7 @@ public class TempestRemastered extends ExpansionSet {
}
private TempestRemastered() {
super("Tempest Remastered", "TPR", "mage.sets.tempestremastered", new GregorianCalendar(2015, 5, 6).getTime(), SetType.REPRINT);
super("Tempest Remastered", "TPR", "mage.sets.tempestremastered", new GregorianCalendar(2015, 5, 6).getTime(), SetType.MAGIC_ONLINE);
this.hasBasicLands = true;
this.hasBoosters = true;
this.numBoosterLands = 1;

View file

@ -36,16 +36,16 @@ import mage.cards.ExpansionSet;
*
* @author BetaSteward_at_googlemail.com
*/
public class Tenth extends ExpansionSet {
public class TenthEdition extends ExpansionSet {
private static final Tenth fINSTANCE = new Tenth();
private static final TenthEdition fINSTANCE = new TenthEdition();
public static Tenth getInstance() {
public static TenthEdition getInstance() {
return fINSTANCE;
}
private Tenth() {
super("Tenth Edition", "10E", "mage.sets.tenth", new GregorianCalendar(2007, 6, 14).getTime(), SetType.CORE);
private TenthEdition() {
super("Tenth Edition", "10E", "mage.sets.tenthedition", new GregorianCalendar(2007, 6, 14).getTime(), SetType.CORE);
this.hasBoosters = true;
this.numBoosterLands = 1;
this.numBoosterCommon = 10;

View file

@ -45,7 +45,8 @@ public class VenserVsKoth extends ExpansionSet {
}
private VenserVsKoth() {
super("Duel Decks: Venser vs. Koth", "DDI", "mage.sets.venservskoth", new GregorianCalendar(2012, 3, 30).getTime(), SetType.DUEL_DECK);
super("Duel Decks: Venser vs. Koth", "DDI", "mage.sets.venservskoth", new GregorianCalendar(2012, 3, 30).getTime(), SetType.SUPPLEMENTAL);
this.blockName = "Duel Decks";
this.hasBasicLands = false;
}
}

View file

@ -52,7 +52,7 @@ public class VintageMasters extends ExpansionSet {
}
private VintageMasters() {
super("Vintage Masters", "VMA", "mage.sets.vintagemasters", new GregorianCalendar(2014, 6, 16).getTime(), SetType.REPRINT);
super("Vintage Masters", "VMA", "mage.sets.vintagemasters", new GregorianCalendar(2014, 6, 16).getTime(), SetType.MAGIC_ONLINE);
this.hasBasicLands = false;
this.hasBoosters = true;
this.numBoosterSpecial = 1;

View file

@ -35,6 +35,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import mage.cards.decks.DeckCardInfo;
import mage.cards.decks.DeckCardLists;
import mage.cards.repository.CardCriteria;
@ -42,12 +43,8 @@ import mage.cards.repository.CardInfo;
import mage.cards.repository.CardRepository;
import mage.constants.CardType;
import mage.constants.ColoredManaSymbol;
import static mage.constants.ColoredManaSymbol.B;
import static mage.constants.ColoredManaSymbol.G;
import static mage.constants.ColoredManaSymbol.R;
import static mage.constants.ColoredManaSymbol.U;
import static mage.constants.ColoredManaSymbol.W;
import mage.util.ClassScanner;
import org.apache.log4j.Logger;
/**

View file

@ -97,13 +97,12 @@ public enum ExpansionRepository {
return sets;
}
public ExpansionInfo[] getSetsFromBlock(String blockName) {
ExpansionInfo[] sets = new ExpansionInfo[0];
public List<ExpansionInfo> getSetsFromBlock(String blockName) {
List<ExpansionInfo> sets = new LinkedList<>();
try {
QueryBuilder<ExpansionInfo, Object> qb = expansionDao.queryBuilder();
qb.where().eq("blockName", new SelectArg(blockName));
List<ExpansionInfo> expansions = expansionDao.query(qb.prepare());
sets = expansions.toArray(new ExpansionInfo[0]);
return expansionDao.query(qb.prepare());
} catch (SQLException ex) {
}
return sets;
@ -123,9 +122,40 @@ public enum ExpansionRepository {
return set;
}
public ExpansionInfo getSetByName(String setName) {
ExpansionInfo set = null;
try {
QueryBuilder<ExpansionInfo, Object> qb = expansionDao.queryBuilder();
qb.where().eq("name", new SelectArg(setName));
List<ExpansionInfo> expansions = expansionDao.query(qb.prepare());
if (expansions.size() > 0) {
set = expansions.get(0);
}
} catch (SQLException ex) {
}
return set;
}
public List<ExpansionInfo> getAll() {
try {
return expansionDao.queryForAll();
QueryBuilder<ExpansionInfo, Object> qb = expansionDao.queryBuilder();
qb.orderBy("releaseDate", true);
return expansionDao.query(qb.prepare());
} catch (SQLException ex) {
}
return new ArrayList<>();
}
public List<String> getAllSetNames() {
try {
QueryBuilder<ExpansionInfo, Object> qb = expansionDao.queryBuilder();
qb.orderBy("releaseDate", true);
List<ExpansionInfo> expansions = expansionDao.query(qb.prepare());
List<String> setNames = new LinkedList<>();
for (ExpansionInfo expansionInfo : expansions) {
setNames.add(expansionInfo.getName());
}
return setNames;
} catch (SQLException ex) {
}
return new ArrayList<>();

View file

@ -5,11 +5,10 @@ package mage.constants;
* @author North
*/
public enum SetType {
CORE("Core"),
DUEL_DECK("Duel Deck"),
EXPANSION("Expansion"),
NON_STANDARD_LEGAL_SETS("Non-standard-legal sets"),
REPRINT("Reprint"),
CORE("Core"),
MAGIC_ONLINE("Magic Online"),
SUPPLEMENTAL("Supplemental"),
PROMOTIONAL("Promotional"),
JOKESET("Joke Set");

View file

@ -47,7 +47,7 @@ public class TournamentUtil {
if (setCodesland.isEmpty()) {
for (String setCode :setCodesDeck) {
ExpansionInfo expansionInfo = ExpansionRepository.instance.getSetByCode(setCode);
ExpansionInfo [] blockSets = ExpansionRepository.instance.getSetsFromBlock(expansionInfo.getBlockName());
List<ExpansionInfo> blockSets = ExpansionRepository.instance.getSetsFromBlock(expansionInfo.getBlockName());
for (ExpansionInfo blockSet: blockSets) {
if (blockSet.hasBasicLands()) {
setCodesland.add(blockSet.getCode());