3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-27 08:30:09 +01:00

Merge pull request #3581 from Jo0001/master

Use our own site for update check
Dieser Commit ist enthalten in:
Myles 2023-12-16 18:15:23 +00:00 committet von GitHub
Commit 9b1716b662
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23

Datei anzeigen

@ -21,6 +21,7 @@ import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.util.GsonUtil;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
@ -28,14 +29,14 @@ import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Locale;
import java.util.UUID;
import org.checkerframework.checker.nullness.qual.Nullable;
public final class UpdateUtil {
private static final String PREFIX = "§a§l[ViaVersion] §a";
private static final String URL = "https://api.spiget.org/v2/resources/";
private static final int PLUGIN = 19254;
private static final String LATEST_VERSION = "/versions/latest";
private static final String URL = "https://update.viaversion.com";
private static final String PLUGIN = "/ViaVersion/";
public static void sendUpdateMessage(final UUID uuid) {
Via.getPlatform().runAsync(() -> {
@ -89,10 +90,11 @@ public final class UpdateUtil {
private static @Nullable String getNewestVersion() {
try {
URL url = new URL(URL + PLUGIN + LATEST_VERSION + "?" + System.currentTimeMillis());
URL url = new URL(URL + PLUGIN);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setUseCaches(true);
connection.setUseCaches(false);
connection.addRequestProperty("User-Agent", "ViaVersion " + Via.getPlatform().getPluginVersion() + " " + Via.getPlatform().getPlatformName());
connection.addRequestProperty("Accept", "application/json");
connection.setDoOutput(true);
BufferedReader br = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String input;