Пример #1
0
 private static TournamentType loadTournamentType(GamePlugin plugin) {
   try {
     classLoader.addURL(new File(pluginFolder + "/" + plugin.getJar()).toURI().toURL());
     logger.info("Loading tournament type: " + plugin.getClassName());
     return (TournamentType) Class.forName(plugin.getTypeName(), true, classLoader).newInstance();
   } catch (ClassNotFoundException ex) {
     logger.warn("Tournament type not found:" + plugin.getJar() + " - check plugin folder");
   } catch (Exception ex) {
     logger.fatal("Error loading game type " + plugin.getJar(), ex);
   }
   return null;
 }
Пример #2
0
 @BeforeClass
 public static void init() {
   Logger.getRootLogger().setLevel(Level.DEBUG);
   logger.info("Starting MAGE tests");
   logger.info("Logging level: " + logger.getLevel());
   deleteSavedGames();
   ConfigSettings config = ConfigSettings.getInstance();
   for (GamePlugin plugin : config.getGameTypes()) {
     GameFactory.getInstance()
         .addGameType(plugin.getName(), loadGameType(plugin), loadPlugin(plugin));
   }
   for (GamePlugin plugin : config.getTournamentTypes()) {
     TournamentFactory.getInstance()
         .addTournamentType(plugin.getName(), loadTournamentType(plugin), loadPlugin(plugin));
   }
   for (Plugin plugin : config.getPlayerTypes()) {
     PlayerFactory.getInstance().addPlayerType(plugin.getName(), loadPlugin(plugin));
   }
   //        for (Plugin plugin : config.getDeckTypes()) {
   //            DeckValidatorFactory.getInstance().addDeckType(plugin.getName(),
   // loadPlugin(plugin));
   //        }
   Copier.setLoader(classLoader);
 }