diff options
| author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-11-30 00:48:01 +0100 |
|---|---|---|
| committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-11-30 00:48:01 +0100 |
| commit | 90ff11ebbdbdbca7af6365344981f72dc3916fc0 (patch) | |
| tree | 0be01c9f43f3e63d1e8c38ded64546566ce35631 /src/main/java/at/hannibal2/skyhanni/config | |
| parent | 247d4d324dc9ce5960d8c94719707d232a89e3ad (diff) | |
| download | skyhanni-90ff11ebbdbdbca7af6365344981f72dc3916fc0.tar.gz skyhanni-90ff11ebbdbdbca7af6365344981f72dc3916fc0.tar.bz2 skyhanni-90ff11ebbdbdbca7af6365344981f72dc3916fc0.zip | |
Using a broken config no longer resets the config in dev env.
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/config')
| -rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt | 16 |
1 files changed, 15 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) } |
