mirror of
https://github.com/correl/mage.git
synced 2024-11-25 03:00:11 +00:00
Server: added loaded plugins stats and error message on outdated config.xml;
This commit is contained in:
parent
0eac8eb530
commit
7670619fc6
1 changed files with 35 additions and 11 deletions
|
@ -55,7 +55,7 @@ public final class Main {
|
||||||
private static final String adminPasswordArg = "-adminPassword=";
|
private static final String adminPasswordArg = "-adminPassword=";
|
||||||
/**
|
/**
|
||||||
* The property that holds the path to the configuration file. Defaults to "config/config.xml".
|
* The property that holds the path to the configuration file. Defaults to "config/config.xml".
|
||||||
*
|
* <p>
|
||||||
* To set up a different one, start the application with the java option "-Dxmage.config.path=<path>"
|
* To set up a different one, start the application with the java option "-Dxmage.config.path=<path>"
|
||||||
*/
|
*/
|
||||||
private static final String configPathProp = "xmage.config.path";
|
private static final String configPathProp = "xmage.config.path";
|
||||||
|
@ -161,33 +161,48 @@ public final class Main {
|
||||||
UserStatsRepository.instance.updateUserStats();
|
UserStatsRepository.instance.updateUserStats();
|
||||||
logger.info("Done.");
|
logger.info("Done.");
|
||||||
deleteSavedGames();
|
deleteSavedGames();
|
||||||
|
|
||||||
|
int gameTypes = 0;
|
||||||
for (GamePlugin plugin : config.getGameTypes()) {
|
for (GamePlugin plugin : config.getGameTypes()) {
|
||||||
|
gameTypes++;
|
||||||
GameFactory.instance.addGameType(plugin.getName(), loadGameType(plugin), loadPlugin(plugin));
|
GameFactory.instance.addGameType(plugin.getName(), loadGameType(plugin), loadPlugin(plugin));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int tourneyTypes = 0;
|
||||||
for (GamePlugin plugin : config.getTournamentTypes()) {
|
for (GamePlugin plugin : config.getTournamentTypes()) {
|
||||||
|
tourneyTypes++;
|
||||||
TournamentFactory.instance.addTournamentType(plugin.getName(), loadTournamentType(plugin), loadPlugin(plugin));
|
TournamentFactory.instance.addTournamentType(plugin.getName(), loadTournamentType(plugin), loadPlugin(plugin));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int playerTypes = 0;
|
||||||
for (Plugin plugin : config.getPlayerTypes()) {
|
for (Plugin plugin : config.getPlayerTypes()) {
|
||||||
|
playerTypes++;
|
||||||
PlayerFactory.instance.addPlayerType(plugin.getName(), loadPlugin(plugin));
|
PlayerFactory.instance.addPlayerType(plugin.getName(), loadPlugin(plugin));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int cubeTypes = 0;
|
||||||
for (Plugin plugin : config.getDraftCubes()) {
|
for (Plugin plugin : config.getDraftCubes()) {
|
||||||
|
cubeTypes++;
|
||||||
CubeFactory.instance.addDraftCube(plugin.getName(), loadPlugin(plugin));
|
CubeFactory.instance.addDraftCube(plugin.getName(), loadPlugin(plugin));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int deckTypes = 0;
|
||||||
for (Plugin plugin : config.getDeckTypes()) {
|
for (Plugin plugin : config.getDeckTypes()) {
|
||||||
|
deckTypes++;
|
||||||
DeckValidatorFactory.instance.addDeckType(plugin.getName(), loadPlugin(plugin));
|
DeckValidatorFactory.instance.addDeckType(plugin.getName(), loadPlugin(plugin));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ExtensionPackage pkg : extensions) {
|
for (ExtensionPackage pkg : extensions) {
|
||||||
Map<String, Class> draftCubes = pkg.getDraftCubes();
|
for (Map.Entry<String, Class> entry : pkg.getDraftCubes().entrySet()) {
|
||||||
draftCubes.forEach((name, draftCube) -> {
|
logger.info("Loading extension: [" + entry.getKey() + "] " + entry.getValue().toString());
|
||||||
logger.info("Loading extension: [" + name + "] " + draftCube.toString());
|
cubeTypes++;
|
||||||
CubeFactory.instance.addDraftCube(name, draftCube);
|
CubeFactory.instance.addDraftCube(entry.getKey(), entry.getValue());
|
||||||
});
|
}
|
||||||
Map<String, Class> deckTypes = pkg.getDeckTypes();
|
for (Map.Entry<String, Class> entry : pkg.getDeckTypes().entrySet()) {
|
||||||
deckTypes.forEach((name, deckType) -> {
|
logger.info("Loading extension: [" + entry.getKey() + "] " + entry.getValue().toString());
|
||||||
logger.info("Loading extension: [" + name + "] " + deckType);
|
deckTypes++;
|
||||||
DeckValidatorFactory.instance.addDeckType(name, deckType);
|
DeckValidatorFactory.instance.addDeckType(entry.getKey(), entry.getValue());
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.info("Config - max seconds idle: " + config.getMaxSecondsIdle());
|
logger.info("Config - max seconds idle: " + config.getMaxSecondsIdle());
|
||||||
|
@ -215,6 +230,15 @@ public final class Main {
|
||||||
logger.info("Config - mail from addre.: " + config.getMailFromAddress());
|
logger.info("Config - mail from addre.: " + config.getMailFromAddress());
|
||||||
logger.info("Config - google account : " + config.getGoogleAccount());
|
logger.info("Config - google account : " + config.getGoogleAccount());
|
||||||
|
|
||||||
|
logger.info("Loaded game types: " + gameTypes
|
||||||
|
+ ", tourneys: " + tourneyTypes
|
||||||
|
+ ", players: " + playerTypes
|
||||||
|
+ ", cubes: " + cubeTypes
|
||||||
|
+ ", decks: " + deckTypes);
|
||||||
|
if (gameTypes == 0) {
|
||||||
|
logger.error("ERROR, can't load any game types. Check your config.xml in server's config folder (example: old jar versions after update).");
|
||||||
|
}
|
||||||
|
|
||||||
Connection connection = new Connection("&maxPoolSize=" + config.getMaxPoolSize());
|
Connection connection = new Connection("&maxPoolSize=" + config.getMaxPoolSize());
|
||||||
connection.setHost(config.getServerAddress());
|
connection.setHost(config.getServerAddress());
|
||||||
connection.setPort(config.getPort());
|
connection.setPort(config.getPort());
|
||||||
|
|
Loading…
Reference in a new issue