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 b1b8d38..9df7b0f 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 @@ -18,7 +18,7 @@ sealed class ButtonImpl: ColoredElement(0.0, 0.0, 73, 8, opacity = 0.60F) { ClickGui.clickBoxes.find { box -> it.let { impl -> with(impl) { - if (info.kind == Type.TOGGLE) { + if (info.kind == Type.TOGGLE && !info.parent.shouldHide) { Configuration.enabledFeatures[title]?.let { bool -> toggled = bool } @@ -48,8 +48,6 @@ sealed class ButtonImpl: ColoredElement(0.0, 0.0, 73, 8, opacity = 0.60F) { it.getDeclaredField("INSTANCE").get(null) } catch (e: NoSuchFieldException) {} } as? ButtonImpl - }.filterNot { - (it.info.parent == Category.RISKY) && !riskyCheats }.plus(Configuration.foundMacros).toTypedArray() ) } diff --git a/common/src/main/kotlin/fr/username404/snowygui/gui/feature/ButtonInfo.kt b/common/src/main/kotlin/fr/username404/snowygui/gui/feature/ButtonInfo.kt index 09a477f..4218139 100644 --- a/common/src/main/kotlin/fr/username404/snowygui/gui/feature/ButtonInfo.kt +++ b/common/src/main/kotlin/fr/username404/snowygui/gui/feature/ButtonInfo.kt @@ -25,9 +25,9 @@ annotation class ButtonInfo( CLICK } } -}; enum class Category(val translationKey: String, val categoryColor: Int) { +}; enum class Category(val translationKey: String, val categoryColor: Int, val shouldHide: Boolean = false) { MISC("snowy.clickbox.misc", Colors.BLUE), - RISKY("snowy.clickbox.risky", Colors.RED), + RISKY("snowy.clickbox.risky", Colors.RED, !riskyCheats), MACROS("snowy.clickbox.macros", Colors.GREEN); companion object { fun fromBox(box: ClickBox): Category? = values().find { @@ -41,9 +41,11 @@ annotation class ButtonInfo( name = TranslatableComponent(translationKey), color = categoryColor ); private set - constructor(translationKey: String, categoryColor: Colors): this(translationKey, categoryColor.hexValue) + constructor( + translationKey: String, categoryColor: Colors, condition: Boolean = false + ): this(translationKey, categoryColor.hexValue, condition) constructor(box: ClickBox): this(translationKey = box.name.key, categoryColor = box.color) { this.box = box } init { - ClickGui.components.add(box) + ClickGui.components.add(box.apply { if (shouldHide) hidden = true }) } }