aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/firmament/gui/config/ManagedConfig.kt
diff options
context:
space:
mode:
authornea <nea@nea.moe>2023-07-11 21:01:58 +0200
committernea <nea@nea.moe>2023-07-11 21:01:58 +0200
commit4d93f475aadc42c4bf83c3a0749af41659235c71 (patch)
treec8e01710defe66e06c50fa962c72fdac66a35a1f /src/main/kotlin/moe/nea/firmament/gui/config/ManagedConfig.kt
parent4444fcca44d9a53c8162d69e0e9f19fd214c2f54 (diff)
downloadFirmament-4d93f475aadc42c4bf83c3a0749af41659235c71.tar.gz
Firmament-4d93f475aadc42c4bf83c3a0749af41659235c71.tar.bz2
Firmament-4d93f475aadc42c4bf83c3a0749af41659235c71.zip
Bulk commit
Diffstat (limited to 'src/main/kotlin/moe/nea/firmament/gui/config/ManagedConfig.kt')
-rw-r--r--src/main/kotlin/moe/nea/firmament/gui/config/ManagedConfig.kt20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/main/kotlin/moe/nea/firmament/gui/config/ManagedConfig.kt b/src/main/kotlin/moe/nea/firmament/gui/config/ManagedConfig.kt
index 417a470..2115fb0 100644
--- a/src/main/kotlin/moe/nea/firmament/gui/config/ManagedConfig.kt
+++ b/src/main/kotlin/moe/nea/firmament/gui/config/ManagedConfig.kt
@@ -30,6 +30,7 @@ import kotlin.io.path.readText
import kotlin.io.path.writeText
import kotlin.properties.ReadWriteProperty
import kotlin.reflect.KProperty
+import kotlin.time.Duration
import net.minecraft.client.gui.screen.Screen
import net.minecraft.text.Text
import moe.nea.firmament.Firmament
@@ -139,6 +140,25 @@ abstract class ManagedConfig(val name: String) {
return option(propertyName, default, BooleanHandler(this))
}
+ protected fun duration(
+ propertyName: String,
+ min: Duration,
+ max: Duration,
+ default: () -> Duration,
+ ): Option<Duration> {
+ return option(propertyName, default, DurationHandler(this, min, max))
+ }
+
+
+ protected fun integer(
+ propertyName: String,
+ min: Int,
+ max: Int,
+ default: () -> Int,
+ ): Option<Int> {
+ return option(propertyName, default, IntegerHandler(this, min, max))
+ }
+
protected fun button(propertyName: String, runnable: () -> Unit): Option<Unit> {
return option(propertyName, { }, ClickHandler(this, runnable))
}