aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt16
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt3
2 files changed, 18 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 b59bf1141..0d806119f 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt
@@ -9,6 +9,7 @@ import at.hannibal2.skyhanni.features.fishing.trophy.TrophyRarity
import at.hannibal2.skyhanni.features.misc.update.UpdateManager
import at.hannibal2.skyhanni.utils.LorenzLogger
import at.hannibal2.skyhanni.utils.LorenzRarity
+import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzVec
import at.hannibal2.skyhanni.utils.NEUInternalName
import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName
@@ -180,7 +181,20 @@ class ConfigManager {
output = if (fileType == ConfigFileType.FEATURES) {
val jsonObject = gson.fromJson(bufferedReader.readText(), JsonObject::class.java)
val newJsonObject = ConfigUpdaterMigrator.fixConfig(jsonObject)
- gson.fromJson(newJsonObject, defaultValue.javaClass)
+ val run = { gson.fromJson(newJsonObject, defaultValue.javaClass) }
+ if (LorenzUtils.isInDevEnviromen()) {
+ try {
+ run()
+ } catch (e: Throwable) {
+ e.printStackTrace()
+ println("This is a crash.")
+ while (true) {
+ // If you know the forge method to shut down correctly, please quietly pr it.
+ }
+ }
+ } else {
+ run()
+ }
} else {
gson.fromJson(bufferedReader.readText(), defaultValue.javaClass)
}
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
index e82ce0da1..8ed5de686 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
@@ -23,6 +23,7 @@ import net.minecraft.entity.EntityLivingBase
import net.minecraft.entity.SharedMonsterAttributes
import net.minecraft.event.ClickEvent
import net.minecraft.event.HoverEvent
+import net.minecraft.launchwrapper.Launch
import net.minecraft.util.ChatComponentText
import java.awt.Color
import java.lang.reflect.Field
@@ -625,4 +626,6 @@ object LorenzUtils {
inline fun <reified T : Enum<T>> enumValueOf(name: String) =
enumValueOfOrNull<T>(name)
?: kotlin.error("Unknown enum constant for ${enumValues<T>().first().name.javaClass.simpleName}: '$name'")
+
+ fun isInDevEnviromen() = Launch.blackboard.get("fml.deobfuscatedEnvironment") as Boolean
}