blob: 2cf9c6f6d31da7a0ebcc8be7bb35d7fc7d0640ea (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
package at.hannibal2.skyhanni.utils
import java.lang.reflect.Field
class OtherModsSettings(val modConfigPath: String) {
companion object {
fun patcher(): OtherModsSettings = getModPath("club.sk1er.patcher.config.PatcherConfig")
private fun getModPath(modConfigPath: String): OtherModsSettings = OtherModsSettings(modConfigPath)
}
fun getBoolean(optionPath: String): Boolean = getOption(optionPath)?.get(null) as? Boolean ?: false
fun setBoolean(optionPath: String, value: Boolean) {
getOption(optionPath)?.set(null, value)
}
private fun getOption(optionPath: String): Field? =
try {
Class.forName(modConfigPath).getField(optionPath)
} catch (e: Throwable) {
null
}
}
|