aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/config
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal002@users.noreply.github.com>2024-04-17 15:20:10 +0200
committerGitHub <noreply@github.com>2024-04-17 15:20:10 +0200
commitbbb447e8c7eb784f2276fbd82c54f03062f58fbc (patch)
tree7e5a408bbc4650c658b6f72388feb45df6b0c9bc /src/main/java/at/hannibal2/skyhanni/config
parenta51e82f92ce5dcd924f3cdbc55b406c3f3dccbcc (diff)
downloadskyhanni-bbb447e8c7eb784f2276fbd82c54f03062f58fbc.tar.gz
skyhanni-bbb447e8c7eb784f2276fbd82c54f03062f58fbc.tar.bz2
skyhanni-bbb447e8c7eb784f2276fbd82c54f03062f58fbc.zip
Backend: Crash in dev env for @ConfigLink (#1455)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/config')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt b/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt
index 7f9b47d6c..93f40cae4 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt
@@ -202,12 +202,27 @@ class ConfigManager {
}
}
+ // Some position elements dont need config links as they dont have a config option.
+ private val ignoredMissingConfigLinks = listOf(
+ // commands
+ "features.garden.GardenConfig.cropSpeedMeterPos",
+ "features.misc.MiscConfig.collectionCounterPos",
+ "features.misc.MiscConfig.lockedMouseDisplay",
+
+ // debug features
+ "features.dev.DebugConfig.trackSoundPosition",
+ "features.dev.DevConfig.debugPos",
+ "features.dev.DevConfig.debugLocationPos",
+ "features.dev.DevConfig.debugItemPos",
+ )
+
private fun findPositionLinks(obj: Any?, slog: MutableSet<IdentityCharacteristics<Any>>) {
if (obj == null) return
if (!obj.javaClass.name.startsWith("at.hannibal2.skyhanni.")) return
val ic = IdentityCharacteristics(obj)
if (ic in slog) return
slog.add(ic)
+ var missingConfigLink = false
for (field in obj.javaClass.fields) {
field.isAccessible = true
if (field.type != Position::class.java) {
@@ -219,13 +234,27 @@ class ConfigManager {
if (LorenzUtils.isInDevEnvironment()) {
var name = "${field.declaringClass.name}.${field.name}"
name = name.replace("at.hannibal2.skyhanni.config.", "")
- println("WEE WOO WEE WOO HIER FEHLT EIN @CONFIGLINK: $name")
+ if (name !in ignoredMissingConfigLinks) {
+ println("WEE WOO WEE WOO HIER FEHLT EIN @CONFIGLINK: $name")
+ missingConfigLink = true
+ }
}
continue
}
val position = field.get(obj) as Position
position.setLink(configLink)
}
+ if (missingConfigLink) {
+ println("")
+ println("This crash is here to remind you to fix the missing @ConfigLink annotation over your new config position config element.")
+ println("")
+ println("Steps to fix:")
+ println("1. Search for `WEE WOO WEE WOO` in the console output.")
+ println("2. Either add the Config Link.")
+ println("3. Or add the name to ignoredMissingConfigLinks.")
+ println("")
+ LorenzUtils.shutdownMinecraft("Missing Config Link")
+ }
}
private fun firstLoadFile(file: File?, fileType: ConfigFileType, defaultValue: Any): Any {