use of org.terasology.engine.utilities.download.MultiFileDownloader in project Terasology by MovingBlocks.
the class ModuleInstaller method call.
@Override
public List<Module> call() throws Exception {
Map<URI, Path> filesToDownload = getDownloadUrls(moduleList);
logger.info("Started downloading {} modules", filesToDownload.size());
MultiFileDownloader downloader = new MultiFileDownloader(filesToDownload, downloadProgressListener);
List<Path> downloadedModulesPaths = downloader.call();
logger.info("Module download completed, loading the new modules...");
List<Module> newInstalledModules = new ArrayList<>(downloadedModulesPaths.size());
for (Path filePath : downloadedModulesPaths) {
try {
Module module = moduleManager.registerArchiveModule(filePath);
newInstalledModules.add(module);
} catch (IOException e) {
logger.warn("Could not load module {}", filePath.getFileName(), e);
}
}
logger.info("Finished loading the downloaded modules");
return newInstalledModules;
}
Aggregations