diff --git a/simplecloud-launcher/src/main/kotlin/eu/thesimplecloud/launcher/updater/BaseUpdater.kt b/simplecloud-launcher/src/main/kotlin/eu/thesimplecloud/launcher/updater/BaseUpdater.kt index 4eb6fbfd..78a759b5 100644 --- a/simplecloud-launcher/src/main/kotlin/eu/thesimplecloud/launcher/updater/BaseUpdater.kt +++ b/simplecloud-launcher/src/main/kotlin/eu/thesimplecloud/launcher/updater/BaseUpdater.kt @@ -23,6 +23,7 @@ package eu.thesimplecloud.launcher.updater import eu.thesimplecloud.api.directorypaths.DirectoryPaths +import eu.thesimplecloud.runner.utils.Downloader import java.io.File class BaseUpdater : AbstractUpdater( @@ -41,6 +42,18 @@ class BaseUpdater : AbstractUpdater( return getVersionFromManifestFile(this.updateFile) } + override fun downloadJarsForUpdate() { + val file = File(DirectoryPaths.paths.storagePath + "base.jar") + + val version = getVersionToInstall() + ?: throw RuntimeException("Cannot perform update. Is the update server down?") + + Downloader().userAgentDownload( + "https://repo.simplecloud.app/releases/eu/thesimplecloud/simplecloud/simplecloud-base/$version/simplecloud-base-$version-all.jar", + file + ) + } + override fun executeJar() { //do nothing } diff --git a/simplecloud-launcher/src/main/kotlin/eu/thesimplecloud/launcher/updater/RunnerUpdater.kt b/simplecloud-launcher/src/main/kotlin/eu/thesimplecloud/launcher/updater/RunnerUpdater.kt index 2fc14413..dab6df5f 100644 --- a/simplecloud-launcher/src/main/kotlin/eu/thesimplecloud/launcher/updater/RunnerUpdater.kt +++ b/simplecloud-launcher/src/main/kotlin/eu/thesimplecloud/launcher/updater/RunnerUpdater.kt @@ -27,6 +27,7 @@ import eu.thesimplecloud.jsonlib.JsonLib import eu.thesimplecloud.launcher.startup.Launcher import eu.thesimplecloud.runner.RunnerFileProvider import eu.thesimplecloud.runner.dependency.AdvancedCloudDependency +import eu.thesimplecloud.runner.utils.Downloader import eu.thesimplecloud.runner.utils.WebContentLoader import java.io.File import java.net.URLClassLoader @@ -54,13 +55,23 @@ class RunnerUpdater( //TODO update to new url val urlstring = "https://update.thesimplecloud.eu/latestVersion/${getCurrentVersion()}?channel=${updateChannel.toChannelString()}" - val content = - WebContentLoader().loadContent(urlstring) - ?: return null + val content = WebContentLoader().loadContent(urlstring) ?: return null this.versionToInstall = JsonLib.fromJsonString(content).getString("latestVersion") return this.versionToInstall } + override fun downloadJarsForUpdate() { + val file = File("runner-update.jar") + + val version = getVersionToInstall() + ?: throw RuntimeException("Cannot perform update. Is the update server down?") + + Downloader().userAgentDownload( + "https://repo.simplecloud.app/releases/eu/thesimplecloud/simplecloud/simplecloud-runner/$version/simplecloud-runner-$version-all.jar", + file + ) + } + override fun executeJar() { val file = File("runner-update.jar") val currentRunnerFile = RunnerFileProvider.RUNNER_FILE