From 93a31c9fd9d4c4054783ec7e0ab6753f0d86d8bb Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 6 Apr 2024 01:19:13 +0200 Subject: code cleanup --- src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt | 3 +-- .../skyhanni/features/misc/update/GuiOptionEditorUpdateCheck.kt | 3 ++- .../at/hannibal2/skyhanni/features/misc/update/UpdateManager.kt | 6 +----- 3 files changed, 4 insertions(+), 8 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt b/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt index b81e1efb8..4059761c3 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt @@ -51,8 +51,7 @@ import kotlin.concurrent.fixedRateTimer typealias TrackerDisplayMode = SkyHanniTracker.DefaultDisplayMode private fun GsonBuilder.reigsterIfBeta(create: TypeAdapterFactory): GsonBuilder { - val isBeta = SkyHanniMod.version.contains("beta", ignoreCase = true) - return if (isBeta) { + return if (LorenzUtils.isBetaVersion()) { registerTypeAdapterFactory(create) } else this } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/update/GuiOptionEditorUpdateCheck.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/update/GuiOptionEditorUpdateCheck.kt index 3b75291a0..e92d6bdf3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/update/GuiOptionEditorUpdateCheck.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/update/GuiOptionEditorUpdateCheck.kt @@ -1,5 +1,6 @@ package at.hannibal2.skyhanni.features.misc.update +import at.hannibal2.skyhanni.SkyHanniMod import io.github.moulberry.moulconfig.gui.GuiOptionEditor import io.github.moulberry.moulconfig.internal.TextRenderUtils import io.github.moulberry.moulconfig.processor.ProcessedOption @@ -44,7 +45,7 @@ class GuiOptionEditorUpdateCheck(option: ProcessedOption) : GuiOptionEditor(opti val widthRemaining = width - button.width - 10 GlStateManager.scale(2F, 2F, 1F) - val currentVersion = UpdateManager.getCurrentVersion() + val currentVersion = SkyHanniMod.version val sameVersion = currentVersion.equals(nextVersion, true) TextRenderUtils.drawStringCenteredScaledMaxWidth( "${if (UpdateManager.updateState == UpdateManager.UpdateState.NONE) GREEN else RED}$currentVersion" + 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 f064ac574..b96533cc6 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 @@ -56,10 +56,6 @@ object UpdateManager { checkUpdate() } - fun getCurrentVersion(): String { - return SkyHanniMod.version - } - fun injectConfigProcessor(processor: MoulConfigProcessor<*>) { processor.registerConfigEditor(ConfigVersionDisplay::class.java) { option, _ -> GuiOptionEditorUpdateCheck(option) @@ -67,7 +63,7 @@ object UpdateManager { } fun isCurrentlyBeta(): Boolean { - return getCurrentVersion().contains("beta", ignoreCase = true) + return SkyHanniMod.version.contains("beta", ignoreCase = true) } private val config get() = SkyHanniMod.feature.about -- cgit