aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/data
diff options
context:
space:
mode:
authorBrandon <brandon.wamboldt@gmail.com>2023-10-15 10:33:55 -0300
committerGitHub <noreply@github.com>2023-10-15 15:33:55 +0200
commit29904921c5d2c81b8d7cb37dcd57af9fd0761343 (patch)
tree27071d1df08073a2356454e6992321cd534dc591 /src/main/java/at/hannibal2/skyhanni/data
parent9755df0878023c73ac18ffc7aa07706b6c0a77c0 (diff)
downloadskyhanni-29904921c5d2c81b8d7cb37dcd57af9fd0761343.tar.gz
skyhanni-29904921c5d2c81b8d7cb37dcd57af9fd0761343.tar.bz2
skyhanni-29904921c5d2c81b8d7cb37dcd57af9fd0761343.zip
Feature: Show alerts when the player catches a legendary sea creature (#530)
dded Alerts when the player catches a legendary sea creature. #530
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