From afca92d1228afdc9a823bba02f6d0562d61952e2 Mon Sep 17 00:00:00 2001 From: inventivetalent Date: Thu, 4 Aug 2016 21:42:03 +0200 Subject: [PATCH] update requests to use /v2 (#479) --- src/main/java/us/myles/ViaVersion/update/UpdateUtil.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/us/myles/ViaVersion/update/UpdateUtil.java b/src/main/java/us/myles/ViaVersion/update/UpdateUtil.java index 7ed0ccdf2..f85e938d2 100644 --- a/src/main/java/us/myles/ViaVersion/update/UpdateUtil.java +++ b/src/main/java/us/myles/ViaVersion/update/UpdateUtil.java @@ -21,8 +21,9 @@ import java.util.UUID; public class UpdateUtil { public final static String PREFIX = ChatColor.GREEN + "" + ChatColor.BOLD + "[ViaVersion] " + ChatColor.GREEN; - private final static String URL = "http://api.spiget.org/v1/resources/"; + private final static String URL = "http://api.spiget.org/v2/resources/"; private final static int PLUGIN = 19254; + private final static String LATEST_VERSION = "/versions/latest"; public static void sendUpdateMessage(final UUID uuid, final Plugin plugin) { new BukkitRunnable() { @@ -94,7 +95,7 @@ public class UpdateUtil { private static String getNewestVersion() { try { - URL url = new URL(URL + PLUGIN + "?" + System.currentTimeMillis()); + URL url = new URL(URL + PLUGIN + LATEST_VERSION + "?" + System.currentTimeMillis()); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setUseCaches(true); connection.addRequestProperty("User-Agent", "ViaVersion " + ViaVersion.getInstance().getVersion()); @@ -114,7 +115,7 @@ public class UpdateUtil { e.printStackTrace(); return null; } - return (String) statistics.get("version"); + return (String) statistics.get("name"); } catch (MalformedURLException e) { return null; } catch (IOException e) {