From 08a3ec8ec388835373b5363cd1219601bfdcc1ad Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 22 Apr 2023 21:47:16 +0200 Subject: Hopefully fixed config reset bug and added more logging --- .../skyhanni/features/misc/update/UpdateManager.kt | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/features') 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 2e3d848b2..10a93753a 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 @@ -3,6 +3,7 @@ package at.hannibal2.skyhanni.features.misc.update import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.features.About import at.hannibal2.skyhanni.events.ConfigLoadEvent +import at.hannibal2.skyhanni.utils.LorenzLogger import at.hannibal2.skyhanni.utils.LorenzUtils import io.github.moulberry.moulconfig.processor.MoulConfigProcessor import io.github.moulberry.notenoughupdates.util.MinecraftExecutor @@ -15,7 +16,7 @@ import java.util.concurrent.CompletableFuture object UpdateManager { - private val logger = SkyHanniMod.getLogger("UpdateManager") + private val logger = LorenzLogger("update_manager") private var _activePromise: CompletableFuture<*>? = null private var activePromise: CompletableFuture<*>? get() = _activePromise @@ -67,24 +68,24 @@ object UpdateManager { updateState = UpdateState.NONE _activePromise = null potentialUpdate = null - logger.info("Reset update state") + logger.log("Reset update state") } fun checkUpdate() { if (updateState != UpdateState.NONE) { - logger.error("Trying to perform update check while another update is already in progress") + logger.log("Trying to perform update check while another update is already in progress") return } - logger.info("Starting update check") + logger.log("Starting update check") var updateStream = config.updateStream.get() if (updateStream == About.UpdateStream.RELEASES && isBetaRelease()) { updateStream = About.UpdateStream.BETA } activePromise = context.checkUpdate(updateStream.stream) .thenAcceptAsync({ - logger.info("Update check completed") + logger.log("Update check completed") if (updateState != UpdateState.NONE) { - logger.warn("This appears to be the second update check. Ignoring this one") + logger.log("This appears to be the second update check. Ignoring this one") return@thenAcceptAsync } potentialUpdate = it @@ -97,14 +98,14 @@ object UpdateManager { fun queueUpdate() { if (updateState != UpdateState.AVAILABLE) { - logger.error("Trying to enqueue an update while another one is already downloaded or none is present") + logger.log("Trying to enqueue an update while another one is already downloaded or none is present") } updateState = UpdateState.QUEUED activePromise = CompletableFuture.supplyAsync { - logger.info("Update download started") + logger.log("Update download started") potentialUpdate!!.prepareUpdate() }.thenAcceptAsync({ - logger.info("Update download completed, setting exit hook") + logger.log("Update download completed, setting exit hook") updateState = UpdateState.DOWNLOADED potentialUpdate!!.executeUpdate() }, MinecraftExecutor.OnThread) -- cgit