From 2db2a723e5f6e172f8b5095a6e77b01fc578690f Mon Sep 17 00:00:00 2001 From: Ellet Date: Thu, 22 Aug 2024 17:47:49 +0300 Subject: [PATCH] fix: apply resource packs in the specified order (#29) Co-authored-by: Ellet --- .../kotlin/syncService/ResourcePacksSyncService.kt | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/sync-script/src/main/kotlin/syncService/ResourcePacksSyncService.kt b/sync-script/src/main/kotlin/syncService/ResourcePacksSyncService.kt index 9b77d3f..c3f750b 100644 --- a/sync-script/src/main/kotlin/syncService/ResourcePacksSyncService.kt +++ b/sync-script/src/main/kotlin/syncService/ResourcePacksSyncService.kt @@ -66,7 +66,7 @@ class ResourcePacksSyncService : ) if (resourcePackSyncInfo.applyResourcePacks) { - applyResourcePacks() + applyResourcePacks(resourcePacks = resourcePacks) } Logger.info { @@ -191,9 +191,10 @@ class ResourcePacksSyncService : } } - private suspend fun applyResourcePacks() { - val resourcePackFilePaths = getScriptLocalResourcePackFilePathsOrAll() - + /** + * @param resourcePacks The list of resource packs to apply, the ones that are synced using the script + * */ + private fun applyResourcePacks(resourcePacks: List) { MinecraftOptionsManager.loadPropertiesFromFile(createIfMissing = true) val optionsResourcePacks: List? = @@ -215,8 +216,9 @@ class ResourcePacksSyncService : userOptionsResourcePacks?.let { addAll(userOptionsResourcePacks) } } addAll( - resourcePackFilePaths - .map { MinecraftOptionsManager.ResourcePack.File(it.name) }, + resourcePacks.map { + MinecraftOptionsManager.ResourcePack.File(getResourcePackFilePath(it).name) + }, ) }, )