Skip to content
This repository was archived by the owner on Dec 3, 2022. It is now read-only.

Commit 4e52e36

Browse files
authored
Merge pull request #20 from Colerar/master
Improve ConfigGUI Regex
2 parents ae1ef88 + 1408fb5 commit 4e52e36

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/main/java/top/wetabq/easyapi/gui/ConfigGUI.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,11 @@ class ConfigGUI<T>(
9090

9191
private fun autoType(value: String): Any {
9292
return when {
93-
value.contains(".") -> value.toDouble()
93+
value.contains(Regex("""^-?\d+\.\d+""")) -> value.toDouble()
9494
value.contains(Regex("(true|false)")) -> value.toBoolean()
95-
value.contains(Regex("-?[0-9]\\d*")) -> value.toInt()
95+
value.contains(Regex("""^[+-]?\d+""")) -> value.toInt()
9696
else -> value
9797
}
9898
}
9999

100-
}
100+
}

0 commit comments

Comments
 (0)