From 1353177f657c23e0186f70c8a53f06b99d80f39f Mon Sep 17 00:00:00 2001 From: Prototik Date: Tue, 9 Jun 2015 12:12:46 +0700 Subject: [PATCH] Mute errors during update in quite mode --- .../java/kcauldron/updater/KCauldronUpdater.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main/java/kcauldron/updater/KCauldronUpdater.java b/src/main/java/kcauldron/updater/KCauldronUpdater.java index 4c86be8..d826e21 100644 --- a/src/main/java/kcauldron/updater/KCauldronUpdater.java +++ b/src/main/java/kcauldron/updater/KCauldronUpdater.java @@ -85,11 +85,12 @@ public class KCauldronUpdater implements Runnable { @Override public void run() { + boolean quite = MinecraftServer.kcauldronConfig.updatecheckerQuite + .getValue(); try { - boolean quite = MinecraftServer.kcauldronConfig.updatecheckerQuite - .getValue(); MinecraftServer server = MinecraftServer.getServer(); - final String filename = KCauldron.getChannel() + "-" + mVersion + "-server.jar"; + final String filename = KCauldron.getChannel() + "-" + mVersion + + "-server.jar"; File path = KCauldron.getServerLocation(); File newPath = new File(path.getParentFile(), getInstallAs(filename)); @@ -125,7 +126,8 @@ public class KCauldronUpdater implements Runnable { HttpResponse response = HttpClientBuilder.create() .setUserAgent("KCauldron Updater").build().execute(request); if (response.getStatusLine().getStatusCode() != 200) { - throw new IllegalStateException("Could not download new version"); + throw new IllegalStateException( + "Could not download new version"); } InputStream is = response.getEntity().getContent(); Files.copy(is, newPath.toPath()); @@ -151,7 +153,9 @@ public class KCauldronUpdater implements Runnable { KCauldron.sNewServerLocation = newPath; KCauldron.sNewServerVersion = mVersion; } catch (Exception e) { - e.printStackTrace(); + if (!quite) { + e.printStackTrace(); + } if (mSender != null) { mSender.sendMessage(ChatColor.RED + "Failed update to " + mVersion);