diff options
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 } |
