diff options
author | Thunderblade73 <85900443+Thunderblade73@users.noreply.github.com> | 2024-03-08 23:18:42 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-08 23:18:42 +0100 |
commit | 497295107a343a5228a91f32e4e5429d0f4d3508 (patch) | |
tree | b4cf7ef7308e16881e2b0c57361270e1b6ca4207 | |
parent | 190a47c8b9df787d19cefd7e1494a7382dcf9ced (diff) | |
download | skyhanni-497295107a343a5228a91f32e4e5429d0f4d3508.tar.gz skyhanni-497295107a343a5228a91f32e4e5429d0f4d3508.tar.bz2 skyhanni-497295107a343a5228a91f32e4e5429d0f4d3508.zip |
Feature: Full Auto Update (#1122)
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/features/About.java | 5 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/misc/update/UpdateManager.kt | 19 |
2 files changed, 18 insertions, 6 deletions
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) } |