From e6410e8c482f3f4a6fac7fedd6e8d32d4999230e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sun, 2 Jan 2022 00:05:00 +0100 Subject: [PATCH] Workaround for https://github.com/MultiMC/Launcher/issues/4400 --- build.gradle | 7 +----- gradle.properties | 2 +- .../installer/detector/IFileDetector.java | 22 ++++++++++++++++--- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/build.gradle b/build.gradle index 45e6dee..a8af5df 100644 --- a/build.gradle +++ b/build.gradle @@ -91,10 +91,5 @@ publishing { tasks.publish.dependsOn build static String getVersionSuffix() { - if (System.getenv("IS_PUBLICATION") != null) { - return "" - } else if (System.getenv("GITHUB_RUN_NUMBER") != null && System.getenv("GITHUB_SHA") != null) { - return "-s." + System.getenv("GITHUB_RUN_NUMBER") + "-" + System.getenv("GITHUB_SHA").substring(0, 7) - } - return "-LOCAL" + return "" } diff --git a/gradle.properties b/gradle.properties index 85a1608..a0365c8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ org.gradle.daemon = false -fw_version = 1.5.5 +fw_version = mmc2 diff --git a/src/main/java/io/github/zekerzhayard/forgewrapper/installer/detector/IFileDetector.java b/src/main/java/io/github/zekerzhayard/forgewrapper/installer/detector/IFileDetector.java index 76df474..67bcbcb 100644 --- a/src/main/java/io/github/zekerzhayard/forgewrapper/installer/detector/IFileDetector.java +++ b/src/main/java/io/github/zekerzhayard/forgewrapper/installer/detector/IFileDetector.java @@ -179,14 +179,24 @@ public interface IFileDetector { // Check all cached libraries. boolean checked = true; for (Map.Entry entry : libsMap.entrySet()) { - checked = checkExtraFile(entry.getValue(), hashMap.get(entry.getKey() + "_SHA")); + String sha1 = ""; + String entryKey = entry.getKey(); + /** + * NOTE: workaround for https://github.com/MultiMC/Launcher/issues/4400 + * We ignore the hash of the client file and instead just rely on it being 'correct, maybe' if it's present at all + */ + System.out.println("Checking: " + entryKey); + if(!entryKey.equals("PATCHED")) { + sha1 = hashMap.get(entryKey + "_SHA"); + } + checked = checkExtraFile(entry.getValue(), sha1); if (!checked) { System.out.println("Missing: " + entry.getValue()); break; } } return checked; - } + } // Skip installing process if installer profile doesn't exist. return true; } @@ -198,7 +208,13 @@ public interface IFileDetector { * @return True represents the file is ready. */ static boolean checkExtraFile(Path path, String sha1) { - return sha1 == null || sha1.equals("") || (isFile(path) && sha1.toLowerCase(Locale.ENGLISH).equals(getFileSHA1(path))); + if (!isFile(path)) { + return false; + } + if(sha1 == null || sha1.equals("")) { + return true; + } + return sha1.toLowerCase(Locale.ENGLISH).equals(getFileSHA1(path)); } static boolean isFile(Path path) {