diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/kotlin/features/mining/PickaxeAbility.kt | 1 | ||||
-rw-r--r-- | src/main/kotlin/gui/config/ChoiceHandler.kt | 1 | ||||
-rw-r--r-- | src/main/kotlin/gui/config/ManagedConfig.kt | 6 |
3 files changed, 4 insertions, 4 deletions
diff --git a/src/main/kotlin/features/mining/PickaxeAbility.kt b/src/main/kotlin/features/mining/PickaxeAbility.kt index a184c81..94b49f9 100644 --- a/src/main/kotlin/features/mining/PickaxeAbility.kt +++ b/src/main/kotlin/features/mining/PickaxeAbility.kt @@ -50,7 +50,6 @@ object PickaxeAbility : FirmamentFeature { val drillFuelBar by toggle("fuel-bar") { true } val blockOnPrivateIsland by choice( "block-on-dynamic", - BlockPickaxeAbility.entries, ) { BlockPickaxeAbility.ONLY_DESTRUCTIVE } diff --git a/src/main/kotlin/gui/config/ChoiceHandler.kt b/src/main/kotlin/gui/config/ChoiceHandler.kt index 25e885a..2ea3efc 100644 --- a/src/main/kotlin/gui/config/ChoiceHandler.kt +++ b/src/main/kotlin/gui/config/ChoiceHandler.kt @@ -13,6 +13,7 @@ import moe.nea.firmament.util.ErrorUtil import moe.nea.firmament.util.json.KJsonOps class ChoiceHandler<E>( + val enumClass: Class<E>, val universe: List<E>, ) : ManagedConfig.OptionHandler<E> where E : Enum<E>, E : StringIdentifiable { val codec = StringIdentifiable.createCodec { diff --git a/src/main/kotlin/gui/config/ManagedConfig.kt b/src/main/kotlin/gui/config/ManagedConfig.kt index ea55f67..641b673 100644 --- a/src/main/kotlin/gui/config/ManagedConfig.kt +++ b/src/main/kotlin/gui/config/ManagedConfig.kt @@ -118,17 +118,17 @@ abstract class ManagedConfig( protected fun <E> choice( propertyName: String, - universe: List<E>, + enumClass: Class<E>, default: () -> E ): ManagedOption<E> where E : Enum<E>, E : StringIdentifiable { - return option(propertyName, default, ChoiceHandler(universe)) + return option(propertyName, default, ChoiceHandler(enumClass, enumClass.enumConstants.toList())) } protected inline fun <reified E> choice( propertyName: String, noinline default: () -> E ): ManagedOption<E> where E : Enum<E>, E : StringIdentifiable { - return choice(propertyName, enumEntries<E>(), default) + return choice(propertyName, E::class.java, default) } private fun <E> createStringIdentifiable(x: () -> Array<out E>): Codec<E> where E : Enum<E>, E : StringIdentifiable { |