From 26fc4f7f798e8caffcf5c4145d20bee77bbf38c9 Mon Sep 17 00:00:00 2001 From: comp500 Date: Tue, 27 Oct 2020 05:18:23 +0000 Subject: [PATCH] Fix text2speech being downloaded twice on macOS Other operating systems (linux/windows) have natives for text2speech but macOS doesn't, so it does an extra download... so we were accidentally downloading it twice! --- .../resolution/sources/MinecraftJarSource.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/main/java/link/infra/jumploader/resolution/sources/MinecraftJarSource.java b/src/main/java/link/infra/jumploader/resolution/sources/MinecraftJarSource.java index 730a6e9..4012c5f 100644 --- a/src/main/java/link/infra/jumploader/resolution/sources/MinecraftJarSource.java +++ b/src/main/java/link/infra/jumploader/resolution/sources/MinecraftJarSource.java @@ -157,15 +157,17 @@ public MetadataResolutionResult resolve(MetadataCacheHelper.MetadataCacheView ca JsonObject downloadsObj = libObj.getAsJsonObject("downloads"); JsonObject nativesObj = libObj.getAsJsonObject("natives"); - if (nativesObj != null && nativesObj.has(currentOS)) { + if (nativesObj != null && nativesObj.size() > 0) { // TODO: should natives be ignored anyway? - we don't/can't handle them properly (see wiki) - String nativesClassifier = nativesObj.get(currentOS).getAsString(); - JsonObject nativesDownloadObj = downloadsObj.getAsJsonObject("classifiers").getAsJsonObject(nativesClassifier); - if (nativesDownloadObj == null) { - throw new RuntimeException("No natives available in " + downloadsObj + " classifier " + nativesClassifier); + if (nativesObj.has(currentOS)) { + String nativesClassifier = nativesObj.get(currentOS).getAsString(); + JsonObject nativesDownloadObj = downloadsObj.getAsJsonObject("classifiers").getAsJsonObject(nativesClassifier); + if (nativesDownloadObj == null) { + throw new RuntimeException("No natives available in " + downloadsObj + " classifier " + nativesClassifier); + } + newMetadata.libs.add(new MinecraftLibraryJar(libObj.get("name").getAsString() + ":" + nativesClassifier, + new URL(nativesDownloadObj.get("url").getAsString()), nativesDownloadObj.get("sha1").getAsString())); } - newMetadata.libs.add(new MinecraftLibraryJar(libObj.get("name").getAsString() + ":" + nativesClassifier, - new URL(nativesDownloadObj.get("url").getAsString()), nativesDownloadObj.get("sha1").getAsString())); continue; }