Made loading cards more verbose (Issue#423)

This commit is contained in:
magenoxx 2014-04-28 15:43:14 +05:30
parent ee030c7b06
commit 7740cc6f66
2 changed files with 22 additions and 22 deletions

View file

@ -28,14 +28,6 @@
package mage.server;
import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException;
import java.net.InetAddress;
import java.net.MalformedURLException;
import java.util.HashMap;
import java.util.Map;
import javax.management.MBeanServer;
import mage.cards.repository.CardScanner;
import mage.game.match.MatchType;
import mage.game.tournament.TournamentType;
@ -54,14 +46,7 @@ import mage.server.util.config.GamePlugin;
import mage.server.util.config.Plugin;
import mage.utils.MageVersion;
import org.apache.log4j.Logger;
import org.jboss.remoting.Client;
import org.jboss.remoting.ClientDisconnectedException;
import org.jboss.remoting.ConnectionListener;
import org.jboss.remoting.InvocationRequest;
import org.jboss.remoting.InvokerLocator;
import org.jboss.remoting.Remoting;
import org.jboss.remoting.ServerInvocationHandler;
import org.jboss.remoting.ServerInvoker;
import org.jboss.remoting.*;
import org.jboss.remoting.callback.InvokerCallbackHandler;
import org.jboss.remoting.callback.ServerInvokerCallbackHandler;
import org.jboss.remoting.transport.Connector;
@ -70,6 +55,15 @@ import org.jboss.remoting.transporter.TransporterClient;
import org.jboss.remoting.transporter.TransporterServer;
import org.w3c.dom.Element;
import javax.management.MBeanServer;
import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException;
import java.net.InetAddress;
import java.net.MalformedURLException;
import java.util.HashMap;
import java.util.Map;
/**
*
@ -88,6 +82,7 @@ public class Main {
public static PluginClassLoader classLoader = new PluginClassLoader();
public static TransporterServer server;
protected static boolean testMode;
/**
* @param args the command line arguments
*/
@ -95,7 +90,9 @@ public class Main {
logger.info("Starting MAGE server version " + version);
logger.info("Logging level: " + logger.getEffectiveLevel());
logger.info("Loading cards...");
CardScanner.scan();
logger.info("Done.");
deleteSavedGames();
ConfigSettings config = ConfigSettings.getInstance();
for (GamePlugin plugin: config.getGameTypes()) {

View file

@ -27,14 +27,12 @@
*/
package mage.cards.repository;
import mage.cards.*;
import mage.util.ClassScanner;
import org.apache.log4j.Logger;
import java.util.ArrayList;
import java.util.List;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.ExpansionSet;
import mage.cards.Sets;
import mage.cards.SplitCard;
import mage.util.ClassScanner;
/**
*
@ -44,6 +42,9 @@ public class CardScanner {
private static boolean scanned = false;
private static final Logger logger = Logger.getLogger(CardScanner.class);
public static void scan() {
if (scanned) {
return;
@ -52,6 +53,7 @@ public class CardScanner {
List<CardInfo> cardsToAdd = new ArrayList<CardInfo>();
List<String> packages = new ArrayList<String>();
for (ExpansionSet set : Sets.getInstance().values()) {
packages.add(set.getPackageName());
ExpansionRepository.instance.add(new ExpansionInfo(set));
@ -71,6 +73,7 @@ public class CardScanner {
}
}
if (!cardsToAdd.isEmpty()) {
logger.info("Cards needed to be stored in DB: " + cardsToAdd.size());
CardRepository.instance.addCards(cardsToAdd);
}
}