Skip to content
This repository was archived by the owner on Apr 29, 2024. It is now read-only.

Commit 95447a5

Browse files
committed
Merge branch 'hotfix/0.3.2'
2 parents 0a55a98 + 9448460 commit 95447a5

File tree

4 files changed

+21
-2
lines changed

4 files changed

+21
-2
lines changed

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>com.nincraft</groupId>
55
<artifactId>ModPackDownloader</artifactId>
6-
<version>0.3.1</version>
6+
<version>0.3.2</version>
77
<name>Mod Pack Downloader</name>
88
<packaging>jar</packaging>
99
<properties>

src/main/java/com/nincraft/modpackdownloader/processor/DownloadModsProcessor.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import com.nincraft.modpackdownloader.container.Manifest;
55
import com.nincraft.modpackdownloader.container.Mod;
66
import com.nincraft.modpackdownloader.handler.ForgeHandler;
7+
import com.nincraft.modpackdownloader.util.Arguments;
78
import com.nincraft.modpackdownloader.util.DownloadHelper;
89
import com.nincraft.modpackdownloader.util.Reference;
910
import lombok.extern.log4j.Log4j2;
@@ -24,7 +25,7 @@ public DownloadModsProcessor(final List<File> manifestFiles) {
2425
}
2526

2627
public static final void downloadMods(final Manifest manifest) {
27-
setExecutorService(Executors.newFixedThreadPool(MOD_LIST.size() + 1));
28+
setExecutorService(Executors.newFixedThreadPool(Arguments.maxDownloadThreads > 0 ? Arguments.maxDownloadThreads : MOD_LIST.size() + 1));
2829
Runnable forgeThread = new Thread(() -> {
2930
ForgeHandler.downloadForge(manifest.getMinecraftVersion(), manifest.getMinecraft().getModLoaders());
3031
});

src/main/java/com/nincraft/modpackdownloader/util/Arguments.java

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ public class Arguments {
1919
@Parameter(names = {"-releaseType"}, description = "Release type for Curse updates. Acceptable parameters" +
2020
"are release, beta, and alpha", validateWith = ReleaseType.class)
2121
public static String releaseType;
22+
@Parameter(names = {"-maxDownloadThreads"}, description = "Max number of threads for downloading mods. The default is however many mods are in your manifest")
23+
public static int maxDownloadThreads;
2224

2325
@Parameter(names = {"-forceDownload"}, description = "Forces downloading instead of pulling from the cache")
2426
public static boolean forceDownload = false;

src/test/java/com/nincraft/modpackdownloader/ModPackDownloaderTest.java

+16
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,22 @@ public void testDownload() throws InterruptedException {
6262
}
6363
}
6464

65+
@Test
66+
public void testDownloadOneThread() throws InterruptedException {
67+
String[] args = {"-manifest", "src/test/resources/download-test.json", "-maxDownloadThreads", "1"};
68+
ModPackDownloader.main(args);
69+
File mod = null;
70+
List<String> mods = new ArrayList<>(Arrays.asList("Thaumcraft-1.8.9-5.2.4.jar", "DimensionalDoors-2.2.5-test9.jar", "pants.jar", "forge-1.8.9-11.15.1.1902-1.8.9-installer.jar"));
71+
List<String> checkFiles = addMods(mods);
72+
73+
for (String fileCheck : checkFiles) {
74+
mod = new File(fileCheck);
75+
log.info("Checking " + mod + ": " + mod.exists());
76+
Assert.assertTrue(mod.exists());
77+
mod.deleteOnExit();
78+
}
79+
}
80+
6581
@Test
6682
public void testUpdate() throws InterruptedException, IOException, ParseException {
6783
String manifestName = "src/test/resources/update-test.json";

0 commit comments

Comments
 (0)