aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/cc/woverflow/chatting/updater/DownloadGui.kt
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/cc/woverflow/chatting/updater/DownloadGui.kt')
-rw-r--r--src/main/kotlin/cc/woverflow/chatting/updater/DownloadGui.kt54
1 files changed, 0 insertions, 54 deletions
diff --git a/src/main/kotlin/cc/woverflow/chatting/updater/DownloadGui.kt b/src/main/kotlin/cc/woverflow/chatting/updater/DownloadGui.kt
deleted file mode 100644
index 10f2f6f..0000000
--- a/src/main/kotlin/cc/woverflow/chatting/updater/DownloadGui.kt
+++ /dev/null
@@ -1,54 +0,0 @@
-package cc.woverflow.chatting.updater
-
-import cc.woverflow.chatting.Chatting
-import gg.essential.api.EssentialAPI
-import gg.essential.api.gui.buildConfirmationModal
-import gg.essential.api.utils.Multithreading
-import gg.essential.elementa.ElementaVersion
-import gg.essential.elementa.WindowScreen
-import gg.essential.elementa.dsl.childOf
-import java.io.File
-
-class DownloadGui : WindowScreen(ElementaVersion.V1, true, true, true, -1) {
- override fun initScreen(width: Int, height: Int) {
- super.initScreen(width, height)
- EssentialAPI.getEssentialComponentFactory().buildConfirmationModal {
- this.text = "Are you sure you want to update?"
- this.secondaryText =
- "(This will update from v${Chatting.VER} to ${Updater.latestTag})"
- this.onConfirm = {
- restorePreviousScreen()
- Multithreading.runAsync {
- if (Updater.download(
- Updater.updateUrl,
- File(
- "mods/${Chatting.NAME}-${
- Updater.latestTag!!.substringAfter("v")
- }.jar"
- )
- ) && Updater.download(
- "https://github.com/Wyvest/Deleter/releases/download/v1.2/Deleter-1.2.jar",
- File(Chatting.modDir.parentFile, "Deleter-1.2.jar")
- )
- ) {
- EssentialAPI.getNotifications()
- .push(
- Chatting.NAME,
- "The ingame updater has successfully installed the newest version."
- )
- Updater.addShutdownHook()
- Updater.shouldUpdate = false
- } else {
- EssentialAPI.getNotifications().push(
- Chatting.NAME,
- "The ingame updater has NOT installed the newest version as something went wrong."
- )
- }
- }
- }
- this.onDeny = {
- restorePreviousScreen()
- }
- } childOf this.window
- }
-} \ No newline at end of file