aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/utils
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal002@users.noreply.github.com>2024-03-22 18:04:45 +0100
committerGitHub <noreply@github.com>2024-03-22 18:04:45 +0100
commita8973b851ad4d3edb0e6c605eb7aea29c6e66938 (patch)
tree4bb7e04fdc48022fb7d9bdcd42915078bf4f7952 /src/main/java/at/hannibal2/skyhanni/utils
parent6231ce3132dd22b539ed76d5999d281d9109ae0b (diff)
downloadskyhanni-a8973b851ad4d3edb0e6c605eb7aea29c6e66938.tar.gz
skyhanni-a8973b851ad4d3edb0e6c605eb7aea29c6e66938.tar.bz2
skyhanni-a8973b851ad4d3edb0e6c605eb7aea29c6e66938.zip
Improvement: Load Trophy Fishing from NEU (#1123)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Co-authored-by: Cal <cwolfson58@gmail.com> Co-authored-by: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt
index 67f01b531..467afe55f 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt
@@ -1,7 +1,9 @@
package at.hannibal2.skyhanni.utils
import at.hannibal2.skyhanni.config.ConfigManager
+import at.hannibal2.skyhanni.data.jsonobjects.other.HypixelPlayerApiJson
import at.hannibal2.skyhanni.data.jsonobjects.repo.MultiFilterJson
+import at.hannibal2.skyhanni.events.NeuProfileDataLoadedEvent
import at.hannibal2.skyhanni.events.NeuRepositoryReloadEvent
import at.hannibal2.skyhanni.events.RepositoryReloadEvent
import at.hannibal2.skyhanni.features.inventory.bazaar.BazaarDataHolder
@@ -15,6 +17,7 @@ import com.google.gson.JsonPrimitive
import io.github.moulberry.notenoughupdates.NEUManager
import io.github.moulberry.notenoughupdates.NEUOverlay
import io.github.moulberry.notenoughupdates.NotEnoughUpdates
+import io.github.moulberry.notenoughupdates.events.ProfileDataLoadedEvent
import io.github.moulberry.notenoughupdates.overlays.AuctionSearchOverlay
import io.github.moulberry.notenoughupdates.overlays.BazaarSearchOverlay
import io.github.moulberry.notenoughupdates.recipes.CraftingRecipe
@@ -63,6 +66,21 @@ object NEUItems {
allItemsCache = readAllNeuItems()
}
+ @SubscribeEvent
+ fun onProfileDataLoaded(event: ProfileDataLoadedEvent) {
+ val apiData = event.data ?: return
+ try {
+ val playerData = ConfigManager.gson.fromJson<HypixelPlayerApiJson>(apiData)
+ NeuProfileDataLoadedEvent(playerData).postAndCatch()
+
+ } catch (e: Exception) {
+ ErrorManager.logErrorWithData(
+ e, "Error reading hypixel player api data",
+ "data" to apiData
+ )
+ }
+ }
+
@Deprecated("Use NEUInternalName rather than String", ReplaceWith("NEUInternalName.fromItemName(itemName)"))
fun getRawInternalName(itemName: String): String = NEUInternalName.fromItemName(itemName).asString()