Don't save default colors to the configuration file

This commit is contained in:
Username404 2021-06-05 14:01:52 +02:00
parent d2bd1c4742
commit 5a17cc3b60
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
1 changed files with 5 additions and 1 deletions

View File

@ -25,7 +25,11 @@ object Configuration {
"macros" to { ConfigValueFactory.fromIterable((ClickGui.components.find { it is ClickBox && it.isCategory(Category.MACROS) } as ClickBox).buttons.map {
Json.encodeToString(it as Macro)
}) },
"box_colors" to { ConfigValueFactory.fromAnyRef(mapOf<String, Int>(*ClickGui.clickboxes.filter { it.name != null }.map { it.name!!.key to it.color }.toTypedArray())) },
"box_colors" to { ConfigValueFactory.fromAnyRef(mapOf<String, Int>(*ClickGui.clickboxes.filter { box ->
box.name != null && Category.values().find { category -> box.name.key == category.translationKey }?.categoryColor != box.color
}.map {
it.name!!.key to it.color
}.toTypedArray())) },
)
private fun Config.withFullModifiableValues() = ModifiableValues.entries.fold(this) { previous, entry ->
previous.withValue(entry.key, entry.value())