mirror of
https://github.com/magefree/mage.git
synced 2025-12-30 07:22:03 -08:00
* Update Gatherer Downloader.
This commit is contained in:
parent
93e573e719
commit
45aa5f675c
8 changed files with 211 additions and 116 deletions
|
|
@ -40,6 +40,7 @@ import java.util.UUID;
|
|||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
|
||||
|
|
@ -54,6 +55,7 @@ public class CardsImpl extends LinkedHashSet<UUID> implements Cards, Serializabl
|
|||
private static Random rnd = new Random();
|
||||
private UUID ownerId;
|
||||
private Zone zone;
|
||||
private boolean errorLogged = false;
|
||||
|
||||
public CardsImpl() { }
|
||||
|
||||
|
|
@ -189,8 +191,17 @@ public class CardsImpl extends LinkedHashSet<UUID> implements Cards, Serializabl
|
|||
if (card != null) {
|
||||
cards.add(card);
|
||||
} else {
|
||||
// seems like this can happen during the cancelation of a game
|
||||
logger.error("Card not found cardId: " + cardId + " gameId: " + game.getId() );
|
||||
if (!errorLogged) { // this runs in iteration, so the flag helps to stop to fill the log file
|
||||
// seems like this can happen during the cancelation of a game
|
||||
logger.error("Card not found cardId: " + cardId + " gameId: " + game.getId() );
|
||||
for (Player player :game.getPlayers().values()) {
|
||||
logger.error(player.getName() + " inGame=" + (player.isInGame() ? "true":"false"));
|
||||
}
|
||||
for (StackTraceElement stackTraceElement: Thread.currentThread().getStackTrace()) {
|
||||
logger.error(stackTraceElement.toString());
|
||||
}
|
||||
errorLogged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return cards;
|
||||
|
|
|
|||
|
|
@ -30,18 +30,26 @@ package mage.cards;
|
|||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import mage.cards.decks.DeckCardInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.ColoredManaSymbol;
|
||||
import mage.cards.decks.DeckCardLists;
|
||||
import mage.cards.repository.CardCriteria;
|
||||
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;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
|
@ -57,7 +65,7 @@ public class Sets extends HashMap<String, ExpansionSet> {
|
|||
}
|
||||
|
||||
private Sets() {
|
||||
ArrayList<String> packages = new ArrayList<String>();
|
||||
ArrayList<String> packages = new ArrayList<>();
|
||||
packages.add("mage.sets");
|
||||
for (Class c : ClassScanner.findClasses(packages, ExpansionSet.class)) {
|
||||
try {
|
||||
|
|
@ -130,8 +138,8 @@ public class Sets extends HashMap<String, ExpansionSet> {
|
|||
|
||||
public static void saveDeck(String file, DeckCardLists deck) throws FileNotFoundException {
|
||||
PrintWriter out = new PrintWriter(file);
|
||||
Map<String, DeckCardInfo> deckCards = new HashMap<String, DeckCardInfo>();
|
||||
Map<String, DeckCardInfo> sideboard = new HashMap<String, DeckCardInfo>();
|
||||
Map<String, DeckCardInfo> deckCards = new HashMap<>();
|
||||
Map<String, DeckCardInfo> sideboard = new HashMap<>();
|
||||
try {
|
||||
if (deck.getName() != null && deck.getName().length() > 0) {
|
||||
out.println("NAME:" + deck.getName());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue