diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/features/dev/DebugConfig.java | 5 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/misc/update/UpdateManager.kt | 28 |
2 files changed, 32 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/dev/DebugConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/dev/DebugConfig.java index 480d2955e..97d378e2d 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/dev/DebugConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/dev/DebugConfig.java @@ -98,6 +98,11 @@ public class DebugConfig { public boolean hotSwapDetection = false; @Expose + @ConfigOption(name = "Always Outdated", desc = "For the sake of the auto updater, act like you are always oudated.") + @ConfigEditorBoolean + public boolean alwaysOutdated = false; + + @Expose @ConfigOption(name = "SkyHanni Event Counter", desc = "Count once per second how many skyhanni events gets triggered, " + "show the total amount in console output.") @ConfigEditorBoolean 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 53a7db0f3..f064ac574 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 @@ -7,17 +7,21 @@ import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.ConditionalUtils.onToggle import at.hannibal2.skyhanni.utils.LorenzLogger +import com.google.gson.JsonElement import io.github.moulberry.moulconfig.processor.MoulConfigProcessor +import io.github.moulberry.notenoughupdates.util.ApiUtil import io.github.moulberry.notenoughupdates.util.MinecraftExecutor import moe.nea.libautoupdate.CurrentVersion import moe.nea.libautoupdate.PotentialUpdate import moe.nea.libautoupdate.UpdateContext import moe.nea.libautoupdate.UpdateSource import moe.nea.libautoupdate.UpdateTarget +import moe.nea.libautoupdate.UpdateUtils import net.minecraft.client.Minecraft import net.minecraftforge.common.MinecraftForge import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import java.util.concurrent.CompletableFuture +import javax.net.ssl.HttpsURLConnection object UpdateManager { @@ -129,12 +133,34 @@ object UpdateManager { private val context = UpdateContext( UpdateSource.githubUpdateSource("hannibal002", "SkyHanni"), UpdateTarget.deleteAndSaveInTheSameFolder(UpdateManager::class.java), - CurrentVersion.ofTag(SkyHanniMod.version), + object : CurrentVersion { + val normalDelegate = CurrentVersion.ofTag(SkyHanniMod.version) + override fun display(): String { + if (SkyHanniMod.feature.dev.debug.alwaysOutdated) + return "Force Outdated" + return normalDelegate.display() + } + + override fun isOlderThan(element: JsonElement): Boolean { + if (SkyHanniMod.feature.dev.debug.alwaysOutdated) + return true + return normalDelegate.isOlderThan(element) + } + + override fun toString(): String { + return "ForceOutdateDelegate($normalDelegate)" + } + }, SkyHanniMod.MODID, ) init { context.cleanup() + UpdateUtils.patchConnection { + if (it is HttpsURLConnection) { + ApiUtil.patchHttpsRequest(it) + } + } } enum class UpdateState { |