Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-09-08 20:43:04 +02:00
More changes to allow Geyser to cooperate better with bad internet (#1951)
Dieser Commit ist enthalten in:
Ursprung
b7828267a5
Commit
f480fbfdf6
@ -147,6 +147,12 @@ public class LocaleUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (IOException ignored) { }
|
} 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();
|
targetHash = clientJarInfo.getSha1();
|
||||||
} else {
|
} else {
|
||||||
curHash = byteArrayToHexString(FileUtils.calculateSHA1(localeFile));
|
curHash = byteArrayToHexString(FileUtils.calculateSHA1(localeFile));
|
||||||
@ -168,9 +174,13 @@ public class LocaleUtils {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the hash and download the locale
|
try {
|
||||||
String hash = ASSET_MAP.get("minecraft/lang/" + locale + ".json").getHash();
|
// Get the hash and download the locale
|
||||||
WebUtils.downloadFile("https://resources.download.minecraft.net/" + hash.substring(0, 2) + "/" + hash, localeFile.toString());
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -88,8 +88,7 @@ public class WebUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String post(String reqURL, String postContent) throws IOException {
|
public static String post(String reqURL, String postContent) throws IOException {
|
||||||
URL url = null;
|
URL url = new URL(reqURL);
|
||||||
url = new URL(reqURL);
|
|
||||||
HttpURLConnection con = (HttpURLConnection) url.openConnection();
|
HttpURLConnection con = (HttpURLConnection) url.openConnection();
|
||||||
con.setRequestMethod("POST");
|
con.setRequestMethod("POST");
|
||||||
con.setRequestProperty("Content-Type", "text/plain");
|
con.setRequestProperty("Content-Type", "text/plain");
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren