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

Commit 0e29741

Browse files
committed
Merge branch 'hotfix/0.2.2'
2 parents 6f378b4 + 80acc1c commit 0e29741

File tree

5 files changed

+11
-10
lines changed

5 files changed

+11
-10
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.2.1</version>
6+
<version>0.2.2</version>
77
<name>Mod Pack Downloader</name>
88
<packaging>jar</packaging>
99
<properties>

src/main/java/com/nincraft/modpackdownloader/container/CurseFile.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ public String buildProjectUrl() {
7474
return String.format(Reference.CURSEFORGE_BASE_URL + "%s" + Reference.COOKIE_TEST_1, getProjectID());
7575
}
7676

77-
@Override
78-
public String getDownloadUrl() {
77+
public String getCurseForgeDownloadUrl() {
7978
return String.format(Reference.CURSEFORGE_BASE_URL + "%s-%s/files/%s/download", getProjectID(), getProjectName(),
8079
getFileID());
8180
}

src/main/java/com/nincraft/modpackdownloader/handler/CurseFileHandler.java

+7-5
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@
2626
@Log4j2
2727
public class CurseFileHandler extends ModHandler {
2828

29-
private static void downloadCurseMod(final CurseFile curseFile) {
29+
private static void downloadCurseMod(CurseFile curseFile) {
3030
try {
31-
curseFile.setFileName(getCurseForgeDownloadLocation(curseFile));
31+
curseFile = getCurseForgeDownloadLocation(curseFile);
3232
DownloadHelper.downloadFile(curseFile);
3333
} catch (IOException e) {
3434
log.error(e);
3535
}
3636
}
3737

38-
private static String getCurseForgeDownloadLocation(final CurseFile curseFile) throws IOException {
39-
String url = curseFile.getDownloadUrl();
38+
private static CurseFile getCurseForgeDownloadLocation(final CurseFile curseFile) throws IOException {
39+
String url = curseFile.getCurseForgeDownloadUrl();
4040
String projectName = curseFile.getName();
4141
String encodedDownloadLocation = URLHelper.encodeSpaces(projectName);
4242

@@ -71,9 +71,11 @@ private static String getCurseForgeDownloadLocation(final CurseFile curseFile) t
7171
} else {
7272
encodedDownloadLocation = projectName + Reference.JAR_FILE_EXT;
7373
}
74+
curseFile.setDownloadUrl(actualURL);
7475
}
76+
curseFile.setFileName(URLHelper.decodeSpaces(encodedDownloadLocation));
7577

76-
return URLHelper.decodeSpaces(encodedDownloadLocation);
78+
return curseFile;
7779
}
7880

7981
public static void updateCurseFile(final CurseFile curseFile) {

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public static DownloadStatus downloadFile(final DownloadableFile downloadableFil
4040
}
4141
val decodedFileName = URLHelper.decodeSpaces(downloadableFile.getFileName());
4242

43-
if (FileSystemHelper.getDownloadedFile(decodedFileName, downloadableFile.getFolder()).exists()) {
43+
if (FileSystemHelper.getDownloadedFile(decodedFileName, downloadableFile.getFolder()).exists() && !Reference.forceDownload) {
4444
log.info(String.format("Found %s already downloaded, skipping", decodedFileName));
4545
return DownloadStatus.SKIPPED;
4646
}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package com.nincraft.modpackdownloader.util;
22

33
public class Reference {
4-
public static final String CURSEFORGE_BASE_URL = "http://minecraft.curseforge.com/projects/";
4+
public static final String CURSEFORGE_BASE_URL = "https://minecraft.curseforge.com/projects/";
55
public static final String CURSEFORGE_WIDGET_JSON_MOD = "mc-mods";
66
public static final String CURSEFORGE_WIDGET_JSON_MODPACK = "modpacks";
77
public static final String CURSEFORGE_WIDGET_JSON_URL = "http://widget.mcf.li/%s/minecraft/%s.json";

0 commit comments

Comments
 (0)