diff options
author | Thunderblade73 <85900443+Thunderblade73@users.noreply.github.com> | 2024-06-23 20:06:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-23 20:06:17 +0200 |
commit | 6eb085f4e2ba69e98934ffa9489c8679ba23d244 (patch) | |
tree | 6f3f4abe26118a5c14ed84ce48408b17665be79f /src/main/java/at/hannibal2/skyhanni/events | |
parent | 78f5f7b94bdc48c3395ef17f30022b8cd653a776 (diff) | |
download | skyhanni-6eb085f4e2ba69e98934ffa9489c8679ba23d244.tar.gz skyhanni-6eb085f4e2ba69e98934ffa9489c8679ba23d244.tar.bz2 skyhanni-6eb085f4e2ba69e98934ffa9489c8679ba23d244.zip |
Feature: Reforge helper (#1437)
Co-authored-by: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com>
Co-authored-by: hannibal2 <24389977+hannibal002@users.noreply.github.com>
Co-authored-by: Cal <cwolfson58@gmail.com>
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/events')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/events/NeuRepositoryReloadEvent.kt | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/events/NeuRepositoryReloadEvent.kt b/src/main/java/at/hannibal2/skyhanni/events/NeuRepositoryReloadEvent.kt index a02cb308f..6f7df5964 100644 --- a/src/main/java/at/hannibal2/skyhanni/events/NeuRepositoryReloadEvent.kt +++ b/src/main/java/at/hannibal2/skyhanni/events/NeuRepositoryReloadEvent.kt @@ -4,6 +4,7 @@ import at.hannibal2.skyhanni.config.ConfigManager import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.NEUItems.manager import at.hannibal2.skyhanni.utils.json.fromJson +import com.google.gson.Gson import com.google.gson.JsonObject import com.google.gson.JsonSyntaxException import java.io.File @@ -13,14 +14,14 @@ class NeuRepositoryReloadEvent : LorenzEvent() { return manager.getJsonFromFile(File(manager.repoLocation, "constants/$file.json")) } - inline fun <reified T : Any> readConstant(file: String): T { + inline fun <reified T : Any> readConstant(file: String, gson: Gson = ConfigManager.gson): T { val data = getConstant(file) ?: ErrorManager.skyHanniError("$file failed to load from neu repo!") return try { - ConfigManager.gson.fromJson<T>(data) + gson.fromJson<T>(data) } catch (e: JsonSyntaxException) { ErrorManager.logErrorWithData( e, "$file failed to read from neu repo!", - "data" to data + "data" to data, ) throw e } |