From fafcc58eef9a5322b4540f494fd332e6329ef811 Mon Sep 17 00:00:00 2001 From: Prototik Date: Fri, 5 Jun 2015 13:34:07 +0700 Subject: [PATCH] Fix for backport updating --- gradle/wrapper/gradle-wrapper.properties | 2 +- src/main/java/kcauldron/updater/KCauldronUpdater.java | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ffcc4c3..ff286c4 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-bin.zip diff --git a/src/main/java/kcauldron/updater/KCauldronUpdater.java b/src/main/java/kcauldron/updater/KCauldronUpdater.java index bdfa034..4c86be8 100644 --- a/src/main/java/kcauldron/updater/KCauldronUpdater.java +++ b/src/main/java/kcauldron/updater/KCauldronUpdater.java @@ -89,7 +89,7 @@ public class KCauldronUpdater implements Runnable { boolean quite = MinecraftServer.kcauldronConfig.updatecheckerQuite .getValue(); MinecraftServer server = MinecraftServer.getServer(); - final String filename = "KCauldron-" + mVersion + "-server.jar"; + final String filename = KCauldron.getChannel() + "-" + mVersion + "-server.jar"; File path = KCauldron.getServerLocation(); File newPath = new File(path.getParentFile(), getInstallAs(filename)); @@ -124,6 +124,9 @@ public class KCauldronUpdater implements Runnable { .addParameter("port", "" + server.getPort()).build(); HttpResponse response = HttpClientBuilder.create() .setUserAgent("KCauldron Updater").build().execute(request); + if (response.getStatusLine().getStatusCode() != 200) { + throw new IllegalStateException("Could not download new version"); + } InputStream is = response.getEntity().getContent(); Files.copy(is, newPath.toPath()); if (mSender != null && !quite) {