diff --git a/Mage/src/main/java/mage/cards/repository/CardScanner.java b/Mage/src/main/java/mage/cards/repository/CardScanner.java index 317e92726c..fdfb30adbe 100644 --- a/Mage/src/main/java/mage/cards/repository/CardScanner.java +++ b/Mage/src/main/java/mage/cards/repository/CardScanner.java @@ -29,7 +29,10 @@ package mage.cards.repository; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; + import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.ExpansionSet; @@ -55,23 +58,28 @@ public class CardScanner { scanned = true; List cardsToAdd = new ArrayList<>(); - List packages = new ArrayList<>(); + Map> packageMap = new HashMap<>(); for (ExpansionSet set : Sets.getInstance().values()) { + ClassLoader cl = set.getClass().getClassLoader(); + if(!packageMap.containsKey(cl)) packageMap.put(cl, new ArrayList()); + List packages = packageMap.get(cl); packages.add(set.getPackageName()); ExpansionRepository.instance.add(new ExpansionInfo(set)); } ExpansionRepository.instance.setContentVersion(ExpansionRepository.instance.getContentVersionConstant()); - for (Class c : ClassScanner.findClasses(null, packages, CardImpl.class)) { - if (!CardRepository.instance.cardExists(c.getCanonicalName())) { - Card card = CardImpl.createCard(c); - if (card != null) { - cardsToAdd.add(new CardInfo(card)); - if (card instanceof SplitCard) { - SplitCard splitCard = (SplitCard) card; - cardsToAdd.add(new CardInfo(splitCard.getLeftHalfCard())); - cardsToAdd.add(new CardInfo(splitCard.getRightHalfCard())); + for (ClassLoader cl : packageMap.keySet()) { + for (Class c : ClassScanner.findClasses(cl, packageMap.get(cl), CardImpl.class)) { + if (!CardRepository.instance.cardExists(c.getCanonicalName())) { + Card card = CardImpl.createCard(c); + if (card != null) { + cardsToAdd.add(new CardInfo(card)); + if (card instanceof SplitCard) { + SplitCard splitCard = (SplitCard) card; + cardsToAdd.add(new CardInfo(splitCard.getLeftHalfCard())); + cardsToAdd.add(new CardInfo(splitCard.getRightHalfCard())); + } } } }