From 7c230f4300b587d18caf2c8b13f2a90e7177a76f Mon Sep 17 00:00:00 2001 From: Griefed Date: Thu, 7 Sep 2023 21:56:16 +0200 Subject: [PATCH] fix: Check for NeoForge installer availability --- .../serverpackcreator/api/ServerPackHandler.kt | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/serverpackcreator-api/src/jvmMain/kotlin/de/griefed/serverpackcreator/api/ServerPackHandler.kt b/serverpackcreator-api/src/jvmMain/kotlin/de/griefed/serverpackcreator/api/ServerPackHandler.kt index 27639ce66..0b1c4fc3a 100644 --- a/serverpackcreator-api/src/jvmMain/kotlin/de/griefed/serverpackcreator/api/ServerPackHandler.kt +++ b/serverpackcreator-api/src/jvmMain/kotlin/de/griefed/serverpackcreator/api/ServerPackHandler.kt @@ -848,11 +848,10 @@ actual class ServerPackHandler actual constructor( override fun serverDownloadable(mcVersion: String, modloader: String, modloaderVersion: String) = when (modloader) { "Fabric" -> utilities.webUtilities.isReachable(versionMeta.fabric.releaseInstallerUrl()) - "Forge" -> (versionMeta.forge.getForgeInstance( - mcVersion, modloaderVersion - ).isPresent && utilities.webUtilities.isReachable( - versionMeta.forge.getForgeInstance(mcVersion, modloaderVersion).get().installerUrl - )) + "Forge" -> { + val instance = versionMeta.forge.getForgeInstance(mcVersion, modloaderVersion) + instance.isPresent && utilities.webUtilities.isReachable(instance.get().installerUrl) + } "Quilt" -> utilities.webUtilities.isReachable(versionMeta.quilt.releaseInstallerUrl()) @@ -864,6 +863,11 @@ actual class ServerPackHandler actual constructor( } } + "NeoForge" -> { + val instance = versionMeta.neoForge.getNeoForgeInstance(mcVersion,modloaderVersion) + instance.isPresent && utilities.webUtilities.isReachable(instance.get().installerUrl) + } + else -> false }