summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/data
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/data')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/repo/RepoUtils.kt9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/repo/RepoUtils.kt b/src/main/java/at/hannibal2/skyhanni/data/repo/RepoUtils.kt
index 6e49b53d3..2438a9be3 100644
--- a/src/main/java/at/hannibal2/skyhanni/data/repo/RepoUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/data/repo/RepoUtils.kt
@@ -11,6 +11,7 @@ import java.io.InputStreamReader
import java.nio.charset.StandardCharsets
import java.nio.file.Files
import java.util.zip.ZipInputStream
+import java.lang.reflect.Type
object RepoUtils {
@@ -83,7 +84,7 @@ object RepoUtils {
return false
}
- fun <T> getConstant(repo: File, constant: String, gson: Gson, clazz: Class<T>?): T? {
+ fun <T> getConstant(repo: File, constant: String, gson: Gson, clazz: Class<T>?, type: Type? = null): T? {
if (!repo.exists()) return null
val jsonFile = File(repo, "constants/$constant.json")
@@ -100,7 +101,11 @@ object RepoUtils {
StandardCharsets.UTF_8
)
).use { reader ->
- return gson.fromJson(reader, clazz)
+ if (type == null) {
+ return gson.fromJson(reader, clazz)
+ } else {
+ return gson.fromJson(reader, type)
+ }
}
}
} \ No newline at end of file