summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/test
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-12-25 01:02:13 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-12-25 01:02:13 +0100
commitd8dad8b5f6cc28b23d503a3fd70c5d36d107eea0 (patch)
tree809f22ca200d79c81a2edfe5e043ff84835840fd /src/main/java/at/hannibal2/skyhanni/test
parent8cdd576927e6731cb07efc9054dee1ddf72d86b5 (diff)
downloadskyhanni-d8dad8b5f6cc28b23d503a3fd70c5d36d107eea0.tar.gz
skyhanni-d8dad8b5f6cc28b23d503a3fd70c5d36d107eea0.tar.bz2
skyhanni-d8dad8b5f6cc28b23d503a3fd70c5d36d107eea0.zip
Added debug command /shfindnullconfig
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/test')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt
index ed87e6da7..1adf858c7 100644
--- a/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt
+++ b/src/main/java/at/hannibal2/skyhanni/test/SkyHanniDebugsAndTests.kt
@@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.config.ConfigFileType
import at.hannibal2.skyhanni.config.ConfigGuiManager
import at.hannibal2.skyhanni.config.ConfigManager
import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
+import at.hannibal2.skyhanni.config.core.config.Position
import at.hannibal2.skyhanni.data.HypixelData
import at.hannibal2.skyhanni.data.SlayerAPI
import at.hannibal2.skyhanni.events.GuiRenderEvent
@@ -136,6 +137,48 @@ class SkyHanniDebugsAndTests {
// }
}
+ fun findNullConfig(args: Array<String>) {
+ println("start null finder")
+ findNull(SkyHanniMod.feature, "config")
+ println("stop null finder")
+ }
+
+ private fun findNull(obj: Any, path: String) {
+
+ val blockedNames = listOf(
+ "TRUE",
+ "FALSE",
+ "SIZE",
+ "MIN_VALUE",
+ "MAX_VALUE",
+ "BYTES",
+ "POSITIVE_INFINITY",
+ "NEGATIVE_INFINITY",
+ "NaN",
+ "MIN_NORMAL",
+ )
+
+ val javaClass = obj.javaClass
+ if (javaClass.isEnum) return
+ for (field in javaClass.fields) {
+ val name = field.name
+ if (name in blockedNames) continue
+
+ // funny thing
+ if (obj is Position) {
+ if (name == "internalName") continue
+ }
+
+ val other = field.makeAccessible().get(obj)
+ val newName = "$path.$name"
+ if (other == null) {
+ println("config null at $newName")
+ } else {
+ findNull(other, newName)
+ }
+ }
+ }
+
fun configManagerResetCommand(args: Array<String>) {
if (args.size == 1 && args[0] == "confirm") {
configManagerReset()