Set<Module> moduleSet = Sets.newLinkedHashSet();
for (NameVersion moduleInfo : networkSystem.getServer().getInfo().getModuleList()) {
Module module = moduleManager.getRegistry().getModule(moduleInfo.getName(), moduleInfo.getVersion());
if (module == null) {
StateMainMenu mainMenu = new StateMainMenu("Missing required module: " + moduleInfo);
CoreRegistry.get(GameEngine.class).changeState(mainMenu);
return false;
} else {
logger.debug("Activating module: {}:{}", moduleInfo.getName(), moduleInfo.getVersion());
gameManifest.addModule(module.getId(), module.getVersion());
moduleSet.add(module);
}
}
moduleManager.loadEnvironment(moduleSet, true);
CoreRegistry.get(Game.class).load(gameManifest);
ApplyModulesUtil.applyModules();
return true;
} else if (joinStatus.getStatus() == JoinStatus.Status.FAILED) {
StateMainMenu mainMenu = new StateMainMenu("Failed to connect to server: " + joinStatus.getErrorMessage());
CoreRegistry.get(GameEngine.class).changeState(mainMenu);
}
return false;
}