Simplify Configuration.ModifiableValues
This commit is contained in:
parent
0b3f3907d2
commit
d2bd1c4742
|
@ -20,13 +20,13 @@ import java.io.File
|
|||
import kotlin.reflect.KProperty
|
||||
|
||||
object Configuration {
|
||||
private val ModifiableValues: MutableMap<String, () -> ConfigValue> = mapOf(
|
||||
private val ModifiableValues = mutableMapOf<String, () -> ConfigValue>(
|
||||
"enabledFeatures" to { ConfigValueFactory.fromMap(enabledFeatures) },
|
||||
"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())) },
|
||||
).toMutableMap()
|
||||
)
|
||||
private fun Config.withFullModifiableValues() = ModifiableValues.entries.fold(this) { previous, entry ->
|
||||
previous.withValue(entry.key, entry.value())
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue