diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/config/ObservedConfigValue.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/config/ObservedConfigValue.kt index 6f8caa5e4..a2a97bfa9 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/config/ObservedConfigValue.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/config/ObservedConfigValue.kt @@ -2,12 +2,13 @@ package ru.dbotthepony.mc.otm.config import net.minecraftforge.common.ForgeConfigSpec.ConfigValue import org.apache.logging.log4j.LogManager +import ru.dbotthepony.mc.otm.core.GetterSetter import java.util.function.Consumer import java.util.function.Supplier import kotlin.properties.ReadWriteProperty import kotlin.reflect.KProperty -abstract class ObservedConfigValue(val parent: ConfigValue) : ReadWriteProperty, Supplier, Consumer { +abstract class ObservedConfigValue(val parent: ConfigValue) : GetterSetter { var rawValue: String by parent private var observedValue: String? = null private var cachedValue: V? = null @@ -43,7 +44,7 @@ abstract class ObservedConfigValue(val parent: ConfigValue) : R return cachedValue ?: throw ConcurrentModificationException() } - override fun getValue(thisRef: Any, property: KProperty<*>): V { + override fun getValue(thisRef: Any?, property: KProperty<*>): V { return get() } @@ -64,7 +65,7 @@ abstract class ObservedConfigValue(val parent: ConfigValue) : R } } - override fun setValue(thisRef: Any, property: KProperty<*>, value: V) { + override fun setValue(thisRef: Any?, property: KProperty<*>, value: V) { accept(value) }