3
0
Mirror von https://github.com/GeyserMC/Geyser.git synchronisiert 2024-07-31 17:48:08 +02:00

More changes to allow Geyser to cooperate better with bad internet (#1951)

Dieser Commit ist enthalten in:
Camotoy 2021-02-21 18:57:09 -05:00 committet von GitHub
Ursprung b7828267a5
Commit f480fbfdf6
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
2 geänderte Dateien mit 14 neuen und 5 gelöschten Zeilen

Datei anzeigen

@ -147,6 +147,12 @@ public class LocaleUtils {
}
}
} catch (IOException ignored) { }
if (clientJarInfo == null) {
// Likely failed to download
GeyserConnector.getInstance().getLogger().debug("Skipping en_US hash check as client jar is null.");
return;
}
targetHash = clientJarInfo.getSha1();
} else {
curHash = byteArrayToHexString(FileUtils.calculateSHA1(localeFile));
@ -168,9 +174,13 @@ public class LocaleUtils {
return;
}
// Get the hash and download the locale
String hash = ASSET_MAP.get("minecraft/lang/" + locale + ".json").getHash();
WebUtils.downloadFile("https://resources.download.minecraft.net/" + hash.substring(0, 2) + "/" + hash, localeFile.toString());
try {
// Get the hash and download the locale
String hash = ASSET_MAP.get("minecraft/lang/" + locale + ".json").getHash();
WebUtils.downloadFile("https://resources.download.minecraft.net/" + hash.substring(0, 2) + "/" + hash, localeFile.toString());
} catch (Exception e) {
GeyserConnector.getInstance().getLogger().error("Unable to download locale file hash", e);
}
}
/**

Datei anzeigen

@ -88,8 +88,7 @@ public class WebUtils {
}
public static String post(String reqURL, String postContent) throws IOException {
URL url = null;
url = new URL(reqURL);
URL url = new URL(reqURL);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "text/plain");