Don't create an empty directory with no modcore...

...version available for the current MCVersion.
This commit is contained in:
altrisi
2020-09-19 15:10:23 +02:00
committed by GitHub
parent 3db25abe48
commit 0561a9f53c

View File

@@ -122,6 +122,11 @@ public class ModCoreInstaller {
public static int initialize(File gameDir, String minecraftVersion) { public static int initialize(File gameDir, String minecraftVersion) {
if (isInitalized()) return -1; if (isInitalized()) return -1;
JsonHolder jsonHolder = fetchJSON(VERSION_URL);
if (!jsonHolder.has(minecraftVersion)) {
System.out.println("No ModCore target for " + minecraftVersion + ". This in fine, unless you're specifically looking for ModCore.");
return -2;
}
dataDir = new File(gameDir, "modcore"); dataDir = new File(gameDir, "modcore");
if (!dataDir.exists()) { if (!dataDir.exists()) {
if (!dataDir.mkdirs()) { if (!dataDir.mkdirs()) {
@@ -129,11 +134,6 @@ public class ModCoreInstaller {
return 1; return 1;
} }
} }
JsonHolder jsonHolder = fetchJSON(VERSION_URL);
if (!jsonHolder.has(minecraftVersion)) {
System.out.println("No ModCore target for " + minecraftVersion + ". This in fine, unless you're specifically looking for ModCore.");
return -2;
}
String latestRemote = jsonHolder.optString(minecraftVersion); String latestRemote = jsonHolder.optString(minecraftVersion);
boolean failed = jsonHolder.getKeys().size() == 0 || (jsonHolder.has("success") && !jsonHolder.optBoolean("success")); boolean failed = jsonHolder.getKeys().size() == 0 || (jsonHolder.has("success") && !jsonHolder.optBoolean("success"));