diff --git a/src/main/kotlin/gg/skytils/skytilsmod/Skytils.kt b/src/main/kotlin/gg/skytils/skytilsmod/Skytils.kt index 4e04f98c2..6d187b895 100644 --- a/src/main/kotlin/gg/skytils/skytilsmod/Skytils.kt +++ b/src/main/kotlin/gg/skytils/skytilsmod/Skytils.kt @@ -18,6 +18,7 @@ package gg.skytils.skytilsmod +import gg.essential.api.EssentialAPI import gg.essential.universal.UChat import gg.essential.universal.UKeyboard import gg.skytils.event.Events @@ -397,6 +398,20 @@ class Skytils { if (config.overrideReparty || !cch.commands.containsKey("rp")) { cch.commandMap["rp"] = RepartyCommand } + + if (UpdateChecker.currentVersion.specialVersionType != UpdateChecker.UpdateType.RELEASE && config.updateChannel == 2) { + if (ModChecker.canShowNotifications) { + EssentialAPI.getNotifications().push("Skytils Update Checker", "You are on a development version of Skytils. Click here to change your update channel to pre-release.") { + onAction = { + config.updateChannel = 1 + config.markDirty() + EssentialAPI.getNotifications().push("Skytils Update Checker", "Your update channel has been changed to pre-release.", duration = 3f) + } + } + } else { + UChat.chat("${prefix} §fYou are on a development version of Skytils. Change your update channel to pre-release to get notified of new updates.") + } + } } @SubscribeEvent(priority = EventPriority.HIGHEST) diff --git a/src/main/kotlin/gg/skytils/skytilsmod/core/UpdateChecker.kt b/src/main/kotlin/gg/skytils/skytilsmod/core/UpdateChecker.kt index 8c65c4350..c310eebac 100644 --- a/src/main/kotlin/gg/skytils/skytilsmod/core/UpdateChecker.kt +++ b/src/main/kotlin/gg/skytils/skytilsmod/core/UpdateChecker.kt @@ -48,6 +48,9 @@ object UpdateChecker { val updateDownloadURL: String get() = updateAsset.downloadUrl + val currentTag = Skytils.VERSION.substringBefore("-dev") + val currentVersion = SkytilsVersion(currentTag) + fun getJarNameFromUrl(url: String): String { return url.split(Regex("/")).last() } @@ -164,9 +167,6 @@ object UpdateChecker { else -> return println("Update Channel set as none") } val latestTag = latestRelease.tagName - val currentTag = Skytils.VERSION.substringBefore("-dev") - - val currentVersion = SkytilsVersion(currentTag) val latestVersion = SkytilsVersion(latestTag.substringAfter("v")) if (currentVersion < latestVersion) { updateObj = latestRelease