* Fixed a bug that prevented that cards from Classic Six Edition were shown in mage.

This commit is contained in:
LevelX2 2015-08-03 14:45:08 +02:00
parent 22c1631587
commit a02c0fac2f
3 changed files with 9 additions and 10 deletions

View file

@ -28,7 +28,6 @@
package mage.sets; package mage.sets;
import java.util.GregorianCalendar; import java.util.GregorianCalendar;
import mage.cards.ExpansionSet; import mage.cards.ExpansionSet;
import mage.constants.SetType; import mage.constants.SetType;

View file

@ -1,12 +1,12 @@
package mage.sets; package mage.sets;
import java.util.GregorianCalendar; import java.util.GregorianCalendar;
import mage.constants.SetType;
import mage.cards.ExpansionSet; import mage.cards.ExpansionSet;
import mage.constants.SetType;
public class FifthEdition extends ExpansionSet { public class FifthEdition extends ExpansionSet {
private static final FifthEdition fINSTANCE = new FifthEdition(); private static final FifthEdition fINSTANCE = new FifthEdition();
public static FifthEdition getInstance() { public static FifthEdition getInstance() {
return fINSTANCE; return fINSTANCE;
@ -19,7 +19,7 @@ public class FifthEdition extends ExpansionSet {
this.numBoosterCommon = 11; this.numBoosterCommon = 11;
this.numBoosterUncommon = 3; this.numBoosterUncommon = 3;
this.numBoosterRare = 1; this.numBoosterRare = 1;
this.ratioBoosterMythic = 0; this.ratioBoosterMythic = 0;
} }
} }

View file

@ -47,13 +47,13 @@ import java.util.jar.JarInputStream;
public class ClassScanner { public class ClassScanner {
public static List<Class> findClasses(List<String> packages, Class<?> type) { public static List<Class> findClasses(List<String> packages, Class<?> type) {
List<Class> cards = new ArrayList<Class>(); List<Class> cards = new ArrayList<>();
try { try {
ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
assert classLoader != null; assert classLoader != null;
HashMap<String, String> dirs = new HashMap<String, String>(); HashMap<String, String> dirs = new HashMap<>();
TreeSet<String> jars = new TreeSet<String>(); TreeSet<String> jars = new TreeSet<>();
for (String packageName : packages) { for (String packageName : packages) {
String path = packageName.replace('.', '/'); String path = packageName.replace('.', '/');
Enumeration<URL> resources = classLoader.getResources(path); Enumeration<URL> resources = classLoader.getResources(path);
@ -84,7 +84,7 @@ public class ClassScanner {
} }
private static List<Class> findClasses(File directory, String packageName, Class<?> type) { private static List<Class> findClasses(File directory, String packageName, Class<?> type) {
List<Class> cards = new ArrayList<Class>(); List<Class> cards = new ArrayList<>();
if (!directory.exists()) { if (!directory.exists()) {
return cards; return cards;
} }
@ -104,7 +104,7 @@ public class ClassScanner {
} }
private static List<Class> findClassesInJar(File file, List<String> packages, Class<?> type) { private static List<Class> findClassesInJar(File file, List<String> packages, Class<?> type) {
List<Class> cards = new ArrayList<Class>(); List<Class> cards = new ArrayList<>();
if (!file.exists()) { if (!file.exists()) {
return cards; return cards;
} }
@ -117,7 +117,7 @@ public class ClassScanner {
break; break;
} }
if (jarEntry.getName().endsWith(".class")) { if (jarEntry.getName().endsWith(".class")) {
String className = jarEntry.getName().replace('/', '.').replace(".class", ""); String className = jarEntry.getName().replace(".class", "").replace('/', '.');
int packageNameEnd = className.lastIndexOf('.'); int packageNameEnd = className.lastIndexOf('.');
String packageName = packageNameEnd != -1 ? className.substring(0, packageNameEnd) : ""; String packageName = packageNameEnd != -1 ? className.substring(0, packageNameEnd) : "";
if (packages.contains(packageName)) { if (packages.contains(packageName)) {