fix: only check once for patch options

This prevents checking for the same patches options multiple times when it is already determined to not have any options
This commit is contained in:
oSumAtrIX
2023-08-24 15:52:12 +02:00
parent a5851f0c1a
commit 11c3a6cfd4

View File

@ -62,14 +62,17 @@ internal object Options {
val patchOptions = deserialize(json)
patches.forEach { patch ->
patches.forEach patch@{ patch ->
patchOptions.find { option -> option.patchName == patch.patchName }?.let {
it.options.forEach { option ->
try {
patch.options?.set(option.key, option.value)
?: logger.warning("${patch.patchName} has no options")
?: run{
logger.warning("${patch.patchName} has no options")
return@patch
}
} catch (e: NoSuchOptionException) {
logger.info(e.message ?: "Unknown error")
logger.info(e.toString())
}
}
}