From 29904921c5d2c81b8d7cb37dcd57af9fd0761343 Mon Sep 17 00:00:00 2001 From: Brandon Date: Sun, 15 Oct 2023 10:33:55 -0300 Subject: Feature: Show alerts when the player catches a legendary sea creature (#530) dded Alerts when the player catches a legendary sea creature. #530 --- src/main/java/at/hannibal2/skyhanni/data/repo/RepoUtils.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/data') 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 getConstant(repo: File, constant: String, gson: Gson, clazz: Class?): T? { + fun getConstant(repo: File, constant: String, gson: Gson, clazz: Class?, 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 -- cgit