From af43e190181f6bc40258d65d137655fa2092673a Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Wed, 2 May 2018 09:07:01 +1000 Subject: [PATCH] Fixes #991 --- core/src/main/java/com/boydti/fawe/Fawe.java | 12 ++++++------ .../main/java/com/boydti/fawe/config/Settings.java | 5 +++-- core/src/main/java/com/boydti/fawe/util/Updater.java | 4 ++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/core/src/main/java/com/boydti/fawe/Fawe.java b/core/src/main/java/com/boydti/fawe/Fawe.java index c5ef59e1..6df0334a 100644 --- a/core/src/main/java/com/boydti/fawe/Fawe.java +++ b/core/src/main/java/com/boydti/fawe/Fawe.java @@ -269,12 +269,12 @@ public class Fawe { TaskManager.IMP.repeat(timer, 1); -// if (Settings.IMP.UPDATE) { - // Delayed updating - updater = new Updater(); - TaskManager.IMP.async(() -> update()); - TaskManager.IMP.repeatAsync(() -> update(), 36000); -// } + if (!Settings.IMP.UPDATE.equalsIgnoreCase("false")) { + // Delayed updating + updater = new Updater(); + TaskManager.IMP.async(() -> update()); + TaskManager.IMP.repeatAsync(() -> update(), 36000); + } } private boolean update() { diff --git a/core/src/main/java/com/boydti/fawe/config/Settings.java b/core/src/main/java/com/boydti/fawe/config/Settings.java index ea263a6c..c7a21f31 100644 --- a/core/src/main/java/com/boydti/fawe/config/Settings.java +++ b/core/src/main/java/com/boydti/fawe/config/Settings.java @@ -26,8 +26,9 @@ public class Settings extends Config { @Comment({"Options: de, ru, tr", "Create a PR to contribute a translation: https://github.com/boy0001/FastAsyncWorldedit/new/master/core/src/main/resources",}) public String LANGUAGE = ""; - @Comment("Enable or disable automatic updates") - public boolean UPDATE = false; + @Comment({"Enable or disable automatic updates", + " - true = update automatically in the background"}) + public String UPDATE = "confirm"; @Comment("Send anonymous usage statistics") public boolean METRICS = true; @Comment({ diff --git a/core/src/main/java/com/boydti/fawe/util/Updater.java b/core/src/main/java/com/boydti/fawe/util/Updater.java index 1f7e8565..fd0af03e 100644 --- a/core/src/main/java/com/boydti/fawe/util/Updater.java +++ b/core/src/main/java/com/boydti/fawe/util/Updater.java @@ -102,11 +102,11 @@ public class Updater { } outFile.renameTo(finalFile); - if (Settings.IMP.UPDATE) { + if (Settings.IMP.UPDATE.equalsIgnoreCase("true")) { installUpdate(null); Fawe.debug("Updated FAWE to " + versionString + " @ " + pendingFile); MainUtil.sendAdmin("&a/restart&7 to update FAWE with these changes: &c/fawe changelog &7or&c " + "https://empcraft.com/fawe/cl?" + Integer.toHexString(currentVersion.hash)); - } else { + } else if (!Settings.IMP.UPDATE.equalsIgnoreCase("false")) { pendingFile = finalFile; destFile = new File(jarFile.getParent(), "update" + File.separator + jarFile.getName()); pending = true;