From 497295107a343a5228a91f32e4e5429d0f4d3508 Mon Sep 17 00:00:00 2001 From: Thunderblade73 <85900443+Thunderblade73@users.noreply.github.com> Date: Fri, 8 Mar 2024 23:18:42 +0100 Subject: Feature: Full Auto Update (#1122) --- .../at/hannibal2/skyhanni/config/features/About.java | 5 +++++ .../skyhanni/features/misc/update/UpdateManager.kt | 19 +++++++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni') diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/About.java b/src/main/java/at/hannibal2/skyhanni/config/features/About.java index 258ba6985..a561a9246 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/About.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/About.java @@ -21,6 +21,11 @@ public class About { @ConfigEditorBoolean public boolean autoUpdates = true; + @ConfigOption(name = "Full Auto Updates", desc = "Automatically downloads new version on each startup.") + @Expose + @ConfigEditorBoolean + public boolean fullAutoUpdates = false; + @ConfigOption(name = "Update Stream", desc = "How frequently do you want updates for SkyHanni") @Expose @ConfigEditorDropdown diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/update/UpdateManager.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/update/UpdateManager.kt index 553e2d3ed..53a7db0f3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/update/UpdateManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/update/UpdateManager.kt @@ -48,7 +48,7 @@ object UpdateManager { fun onTick(event: LorenzTickEvent) { Minecraft.getMinecraft().thePlayer ?: return MinecraftForge.EVENT_BUS.unregister(this) - if (config.autoUpdates) + if (config.autoUpdates || config.fullAutoUpdates) checkUpdate() } @@ -95,11 +95,16 @@ object UpdateManager { potentialUpdate = it if (it.isUpdateAvailable) { updateState = UpdateState.AVAILABLE - ChatUtils.clickableChat( - "§aSkyHanni found a new update: ${it.update.versionName}. " + - "Check §b/sh download update §afor more info.", - "sh" - ) + if (config.fullAutoUpdates) { + ChatUtils.chat("§aSkyHanni found a new update: ${it.update.versionName}, starting to download now. ") + queueUpdate() + } else if (config.autoUpdates) { + ChatUtils.clickableChat( + "§aSkyHanni found a new update: ${it.update.versionName}. " + + "Check §b/sh download update §afor more info.", + "sh" + ) + } } }, MinecraftExecutor.OnThread) } @@ -116,6 +121,8 @@ object UpdateManager { logger.log("Update download completed, setting exit hook") updateState = UpdateState.DOWNLOADED potentialUpdate!!.executePreparedUpdate() + ChatUtils.chat("Download of update complete. ") + ChatUtils.chat("§aThe update will be installed after your next restart.") }, MinecraftExecutor.OnThread) } -- cgit