mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
server: fixed that's server can't start on some wrong config settings (part 2)
This commit is contained in:
parent
9de731b522
commit
d861f67232
1 changed files with 15 additions and 2 deletions
|
|
@ -4,7 +4,9 @@ import mage.cards.ExpansionSet;
|
||||||
import mage.cards.RateCard;
|
import mage.cards.RateCard;
|
||||||
import mage.cards.Sets;
|
import mage.cards.Sets;
|
||||||
import mage.cards.decks.DeckValidatorFactory;
|
import mage.cards.decks.DeckValidatorFactory;
|
||||||
import mage.cards.repository.*;
|
import mage.cards.repository.CardScanner;
|
||||||
|
import mage.cards.repository.PluginClassloaderRegistery;
|
||||||
|
import mage.cards.repository.RepositoryUtil;
|
||||||
import mage.game.match.MatchType;
|
import mage.game.match.MatchType;
|
||||||
import mage.game.tournament.TournamentType;
|
import mage.game.tournament.TournamentType;
|
||||||
import mage.interfaces.MageServer;
|
import mage.interfaces.MageServer;
|
||||||
|
|
@ -507,8 +509,19 @@ public final class Main {
|
||||||
|
|
||||||
private static Class<?> loadPlugin(Plugin plugin) {
|
private static Class<?> loadPlugin(Plugin plugin) {
|
||||||
try {
|
try {
|
||||||
classLoader.addURL(new File(pluginFolder, plugin.getJar()).toURI().toURL());
|
|
||||||
logger.debug("Loading plugin: " + plugin.getClassName());
|
logger.debug("Loading plugin: " + plugin.getClassName());
|
||||||
|
if (plugin.getName() == null || plugin.getName().isEmpty()
|
||||||
|
|| plugin.getJar() == null || plugin.getJar().isEmpty()
|
||||||
|
|| plugin.getClassName() == null || plugin.getClassName().isEmpty()
|
||||||
|
) {
|
||||||
|
logger.error(String.format("Can't load plugin, found miss fields in config.xml: %s, %s, %s",
|
||||||
|
plugin.getName(),
|
||||||
|
plugin.getJar(),
|
||||||
|
plugin.getClassName()
|
||||||
|
));
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
classLoader.addURL(new File(pluginFolder, plugin.getJar()).toURI().toURL());
|
||||||
return Class.forName(plugin.getClassName(), true, classLoader);
|
return Class.forName(plugin.getClassName(), true, classLoader);
|
||||||
} catch (ClassNotFoundException ex) {
|
} catch (ClassNotFoundException ex) {
|
||||||
logger.warn(new StringBuilder("Plugin not Found: ").append(plugin.getClassName()).append(" - ").append(plugin.getJar()).append(" - check plugin folder"), ex);
|
logger.warn(new StringBuilder("Plugin not Found: ").append(plugin.getClassName()).append(" - ").append(plugin.getJar()).append(" - check plugin folder"), ex);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue