Mute errors during update in quite mode
This commit is contained in:
parent
474ef40d59
commit
1353177f65
@ -85,11 +85,12 @@ public class KCauldronUpdater implements Runnable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
boolean quite = MinecraftServer.kcauldronConfig.updatecheckerQuite
|
||||||
|
.getValue();
|
||||||
try {
|
try {
|
||||||
boolean quite = MinecraftServer.kcauldronConfig.updatecheckerQuite
|
|
||||||
.getValue();
|
|
||||||
MinecraftServer server = MinecraftServer.getServer();
|
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 path = KCauldron.getServerLocation();
|
||||||
File newPath = new File(path.getParentFile(),
|
File newPath = new File(path.getParentFile(),
|
||||||
getInstallAs(filename));
|
getInstallAs(filename));
|
||||||
@ -125,7 +126,8 @@ public class KCauldronUpdater implements Runnable {
|
|||||||
HttpResponse response = HttpClientBuilder.create()
|
HttpResponse response = HttpClientBuilder.create()
|
||||||
.setUserAgent("KCauldron Updater").build().execute(request);
|
.setUserAgent("KCauldron Updater").build().execute(request);
|
||||||
if (response.getStatusLine().getStatusCode() != 200) {
|
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();
|
InputStream is = response.getEntity().getContent();
|
||||||
Files.copy(is, newPath.toPath());
|
Files.copy(is, newPath.toPath());
|
||||||
@ -151,7 +153,9 @@ public class KCauldronUpdater implements Runnable {
|
|||||||
KCauldron.sNewServerLocation = newPath;
|
KCauldron.sNewServerLocation = newPath;
|
||||||
KCauldron.sNewServerVersion = mVersion;
|
KCauldron.sNewServerVersion = mVersion;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
if (!quite) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
if (mSender != null) {
|
if (mSender != null) {
|
||||||
mSender.sendMessage(ChatColor.RED + "Failed update to "
|
mSender.sendMessage(ChatColor.RED + "Failed update to "
|
||||||
+ mVersion);
|
+ mVersion);
|
||||||
|
Loading…
Reference in New Issue
Block a user