diff --git a/common/src/main/kotlin/fr/username404/snowygui/config/Configuration.kt b/common/src/main/kotlin/fr/username404/snowygui/config/Configuration.kt index aea244e..8c92788 100644 --- a/common/src/main/kotlin/fr/username404/snowygui/config/Configuration.kt +++ b/common/src/main/kotlin/fr/username404/snowygui/config/Configuration.kt @@ -95,11 +95,7 @@ object Configuration { val enabledFeatures = mutableMapOf().apply { "enabledFeatures".let { obtained.run { if (hasPath(it)) { - putAll(extract>(it).filterKeys { keyName -> ClickGui.clickBoxes.any { - it.buttons.any { button -> - button.info.shouldSave() && button.title == keyName - } - }}) + putAll(extract>(it)) } } } } diff --git a/common/src/main/kotlin/fr/username404/snowygui/gui/feature/ButtonImpl.kt b/common/src/main/kotlin/fr/username404/snowygui/gui/feature/ButtonImpl.kt index 287648e..6777692 100644 --- a/common/src/main/kotlin/fr/username404/snowygui/gui/feature/ButtonImpl.kt +++ b/common/src/main/kotlin/fr/username404/snowygui/gui/feature/ButtonImpl.kt @@ -17,25 +17,20 @@ sealed class ButtonImpl: ColoredElement(0.0, 0.0, 73, 8, opacity = 0.60F) { private fun addButtons(vararg buttons: ButtonImpl) { buttons.groupBy { impl -> ClickGui.clickBoxes.find { box -> - with(impl) { + box.isCategory(impl.info.parent) + } + }.entries.forEach { entry -> entry.run { + key?.buttons?.clear() + value.forEach { if (!it.isDisabled) { + key?.buttons?.add(it.apply { if (info.shouldSave() && !info.parent.shouldHide) { Configuration.enabledFeatures[title]?.let { bool -> toggled = bool } } - box.isCategory(info.parent) - } - } - }.entries.forEach { entry -> - with(entry) { - key?.buttons?.clear() - value.forEach { - if (!it.isDisabled) { - key?.buttons?.add(it) - } - } - } - } + }) + } } + } } } @JvmStatic fun initButtons() = addButtons(