diff options
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
5 files changed, 196 insertions, 137 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt b/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt index 65c252bae..b0d5bf9c9 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/ConfigManager.kt @@ -7,7 +7,6 @@ import at.hannibal2.skyhanni.data.jsonobjects.local.FriendsJson import at.hannibal2.skyhanni.data.jsonobjects.local.JacobContestsJson import at.hannibal2.skyhanni.data.jsonobjects.local.KnownFeaturesJson import at.hannibal2.skyhanni.data.jsonobjects.local.VisualWordsJson -import at.hannibal2.skyhanni.data.jsonobjects.other.HypixelApiTrophyFish import at.hannibal2.skyhanni.events.LorenzEvent import at.hannibal2.skyhanni.features.fishing.trophy.TrophyRarity import at.hannibal2.skyhanni.features.misc.update.UpdateManager @@ -21,16 +20,15 @@ import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.NEUItems -import at.hannibal2.skyhanni.utils.NumberUtil.isInt import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.SimpleTimeMark.Companion.asTimeMark import at.hannibal2.skyhanni.utils.tracker.SkyHanniTracker +import com.google.gson.Gson import com.google.gson.GsonBuilder import com.google.gson.JsonObject import com.google.gson.TypeAdapter import com.google.gson.TypeAdapterFactory import com.google.gson.stream.JsonReader -import com.google.gson.stream.JsonToken import com.google.gson.stream.JsonWriter import io.github.notenoughupdates.moulconfig.annotations.ConfigLink import io.github.notenoughupdates.moulconfig.observer.PropertyTypeAdapterFactory @@ -62,122 +60,99 @@ private fun GsonBuilder.reigsterIfBeta(create: TypeAdapterFactory): GsonBuilder class ConfigManager { companion object { + fun createBaseGsonBuilder(): GsonBuilder { + return GsonBuilder().setPrettyPrinting() + .excludeFieldsWithoutExposeAnnotation() + .serializeSpecialFloatingPointValues() + .registerTypeAdapterFactory(PropertyTypeAdapterFactory()) + .registerTypeAdapterFactory(KotlinTypeAdapterFactory()) + .registerTypeAdapter(UUID::class.java, object : TypeAdapter<UUID>() { + override fun write(out: JsonWriter, value: UUID) { + out.value(value.toString()) + } - val gson = GsonBuilder().setPrettyPrinting() - .excludeFieldsWithoutExposeAnnotation() - .serializeSpecialFloatingPointValues() - .reigsterIfBeta(FeatureTogglesByDefaultAdapter) - .registerTypeAdapterFactory(PropertyTypeAdapterFactory()) - .registerTypeAdapterFactory(KotlinTypeAdapterFactory()) - .registerTypeAdapter(UUID::class.java, object : TypeAdapter<UUID>() { - override fun write(out: JsonWriter, value: UUID) { - out.value(value.toString()) - } - - override fun read(reader: JsonReader): UUID { - return UUID.fromString(reader.nextString()) - } - }.nullSafe()) - .registerTypeAdapter(LorenzVec::class.java, object : TypeAdapter<LorenzVec>() { - override fun write(out: JsonWriter, value: LorenzVec) { - value.run { out.value("$x:$y:$z") } - } + override fun read(reader: JsonReader): UUID { + return UUID.fromString(reader.nextString()) + } + }.nullSafe()) + .registerTypeAdapter(LorenzVec::class.java, object : TypeAdapter<LorenzVec>() { + override fun write(out: JsonWriter, value: LorenzVec) { + value.run { out.value("$x:$y:$z") } + } - override fun read(reader: JsonReader): LorenzVec { - return LorenzVec.decodeFromString(reader.nextString()) - } - }.nullSafe()) - .registerTypeAdapter(TrophyRarity::class.java, object : TypeAdapter<TrophyRarity>() { - override fun write(out: JsonWriter, value: TrophyRarity) { - value.run { out.value(value.name) } - } + override fun read(reader: JsonReader): LorenzVec { + return LorenzVec.decodeFromString(reader.nextString()) + } + }.nullSafe()) + .registerTypeAdapter(TrophyRarity::class.java, object : TypeAdapter<TrophyRarity>() { + override fun write(out: JsonWriter, value: TrophyRarity) { + value.run { out.value(value.name) } + } - override fun read(reader: JsonReader): TrophyRarity { - val text = reader.nextString() - return TrophyRarity.getByName(text) ?: error("Could not parse TrophyRarity from '$text'") - } - }.nullSafe()) - .registerTypeAdapter(ItemStack::class.java, object : TypeAdapter<ItemStack>() { - override fun write(out: JsonWriter, value: ItemStack) { - out.value(NEUItems.saveNBTData(value)) - } + override fun read(reader: JsonReader): TrophyRarity { + val text = reader.nextString() + return TrophyRarity.getByName(text) ?: error("Could not parse TrophyRarity from '$text'") + } + }.nullSafe()) + .registerTypeAdapter(ItemStack::class.java, object : TypeAdapter<ItemStack>() { + override fun write(out: JsonWriter, value: ItemStack) { + out.value(NEUItems.saveNBTData(value)) + } - override fun read(reader: JsonReader): ItemStack { - return NEUItems.loadNBTData(reader.nextString()) - } - }.nullSafe()) - .registerTypeAdapter(NEUInternalName::class.java, object : TypeAdapter<NEUInternalName>() { - override fun write(out: JsonWriter, value: NEUInternalName) { - out.value(value.asString()) - } + override fun read(reader: JsonReader): ItemStack { + return NEUItems.loadNBTData(reader.nextString()) + } + }.nullSafe()) + .registerTypeAdapter(NEUInternalName::class.java, object : TypeAdapter<NEUInternalName>() { + override fun write(out: JsonWriter, value: NEUInternalName) { + out.value(value.asString()) + } - override fun read(reader: JsonReader): NEUInternalName { - return reader.nextString().asInternalName() - } - }.nullSafe()) - .registerTypeAdapter(LorenzRarity::class.java, object : TypeAdapter<LorenzRarity>() { - override fun write(out: JsonWriter, value: LorenzRarity) { - out.value(value.name) - } + override fun read(reader: JsonReader): NEUInternalName { + return reader.nextString().asInternalName() + } + }.nullSafe()) + .registerTypeAdapter(LorenzRarity::class.java, object : TypeAdapter<LorenzRarity>() { + override fun write(out: JsonWriter, value: LorenzRarity) { + out.value(value.name) + } - override fun read(reader: JsonReader): LorenzRarity { - return LorenzRarity.valueOf(reader.nextString().uppercase()) - } - }.nullSafe()) - .registerTypeAdapter(IslandType::class.java, object : TypeAdapter<IslandType>() { - override fun write(out: JsonWriter, value: IslandType) { - out.value(value.name) - } + override fun read(reader: JsonReader): LorenzRarity { + return LorenzRarity.valueOf(reader.nextString().uppercase()) + } + }.nullSafe()) + .registerTypeAdapter(IslandType::class.java, object : TypeAdapter<IslandType>() { + override fun write(out: JsonWriter, value: IslandType) { + out.value(value.name) + } - override fun read(reader: JsonReader): IslandType { - return IslandType.valueOf(reader.nextString().uppercase()) - } - }.nullSafe()) - .registerTypeAdapter(TrackerDisplayMode::class.java, object : TypeAdapter<TrackerDisplayMode>() { - override fun write(out: JsonWriter, value: TrackerDisplayMode) { - out.value(value.name) - } + override fun read(reader: JsonReader): IslandType { + return IslandType.valueOf(reader.nextString().uppercase()) + } + }.nullSafe()) + .registerTypeAdapter(TrackerDisplayMode::class.java, object : TypeAdapter<TrackerDisplayMode>() { + override fun write(out: JsonWriter, value: TrackerDisplayMode) { + out.value(value.name) + } - override fun read(reader: JsonReader): TrackerDisplayMode { - return TrackerDisplayMode.valueOf(reader.nextString()) - } - }.nullSafe()) - .registerTypeAdapter(SimpleTimeMark::class.java, object : TypeAdapter<SimpleTimeMark>() { - override fun write(out: JsonWriter, value: SimpleTimeMark) { - out.value(value.toMillis()) - } + override fun read(reader: JsonReader): TrackerDisplayMode { + return TrackerDisplayMode.valueOf(reader.nextString()) + } + }.nullSafe()) + .registerTypeAdapter(SimpleTimeMark::class.java, object : TypeAdapter<SimpleTimeMark>() { + override fun write(out: JsonWriter, value: SimpleTimeMark) { + out.value(value.toMillis()) + } - override fun read(reader: JsonReader): SimpleTimeMark { - return reader.nextString().toLong().asTimeMark() - } - }.nullSafe()) - .registerTypeAdapter(HypixelApiTrophyFish::class.java, object : TypeAdapter<HypixelApiTrophyFish>() { - override fun write(out: JsonWriter, value: HypixelApiTrophyFish) {} - - override fun read(reader: JsonReader): HypixelApiTrophyFish { - val trophyFish = mutableMapOf<String, Int>() - var totalCaught = 0 - reader.beginObject() - while (reader.hasNext()) { - val key = reader.nextName() - if (key == "total_caught") { - totalCaught = reader.nextInt() - continue - } - if (reader.peek() == JsonToken.NUMBER) { - val valueAsString = reader.nextString() - if (valueAsString.isInt()) { - trophyFish[key] = valueAsString.toInt() - continue - } - } - reader.skipValue() + override fun read(reader: JsonReader): SimpleTimeMark { + return reader.nextString().toLong().asTimeMark() } - reader.endObject() - return HypixelApiTrophyFish(totalCaught, trophyFish) - } - }.nullSafe()) - .enableComplexMapKeySerialization() + }.nullSafe()) + .enableComplexMapKeySerialization() + } + + val gson: Gson = createBaseGsonBuilder() + .reigsterIfBeta(FeatureTogglesByDefaultAdapter) .create() var configDirectory = File("config/skyhanni") diff --git a/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/other/EliteBotJson.kt b/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/other/EliteBotJson.kt index 3cdcfa512..2f2543f56 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/other/EliteBotJson.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/jsonobjects/other/EliteBotJson.kt @@ -1,9 +1,11 @@ package at.hannibal2.skyhanni.data.jsonobjects.other +import at.hannibal2.skyhanni.features.garden.CropType +import at.hannibal2.skyhanni.features.garden.pests.PestType import com.google.gson.annotations.Expose import com.google.gson.annotations.SerializedName -data class EliteWeightJson( +data class ElitePlayerWeightJson( @Expose val selectedProfileId: String, @Expose val profiles: List<WeightProfile> ) @@ -11,7 +13,11 @@ data class EliteWeightJson( data class WeightProfile( @Expose val profileId: String, @Expose val profileName: String, - @Expose val totalWeight: Double + @Expose val totalWeight: Double, + @Expose val cropWeight: Map<CropType, Double>, + @Expose val bonusWeight: Map<String, Int>, + @Expose val uncountedCrops: Map<CropType, Int>, + @Expose val pests: Map<PestType, Int> ) data class EliteLeaderboardJson( @@ -28,3 +34,13 @@ data class UpcomingLeaderboardPlayer( @Expose @SerializedName("ign") val name: String, @Expose @SerializedName("amount") val weight: Double ) + +data class EliteWeightsJson( + @Expose val crops: Map<CropType, Double>, + @Expose val pests: PestWeightData +) + +data class PestWeightData( + @Expose val brackets: Map<Int, Int>, + @Expose @SerializedName("values") val pestWeights: Map<PestType, Map<Int, Double>> +) diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt index 71490fe2a..3025ae7d1 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/FarmingWeightDisplay.kt @@ -7,7 +7,8 @@ import at.hannibal2.skyhanni.config.enums.OutsideSbFeature import at.hannibal2.skyhanni.data.HypixelData import at.hannibal2.skyhanni.data.ProfileStorageData import at.hannibal2.skyhanni.data.jsonobjects.other.EliteLeaderboardJson -import at.hannibal2.skyhanni.data.jsonobjects.other.EliteWeightJson +import at.hannibal2.skyhanni.data.jsonobjects.other.ElitePlayerWeightJson +import at.hannibal2.skyhanni.data.jsonobjects.other.EliteWeightsJson import at.hannibal2.skyhanni.data.jsonobjects.other.UpcomingLeaderboardPlayer import at.hannibal2.skyhanni.events.GardenToolChangeEvent import at.hannibal2.skyhanni.events.GuiRenderEvent @@ -17,6 +18,7 @@ import at.hannibal2.skyhanni.events.ProfileJoinEvent import at.hannibal2.skyhanni.features.garden.CropType import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.features.garden.farming.GardenCropSpeed.getSpeed +import at.hannibal2.skyhanni.features.garden.pests.PestType import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.APIUtil import at.hannibal2.skyhanni.utils.ChatUtils @@ -31,9 +33,12 @@ import at.hannibal2.skyhanni.utils.TimeUtils import at.hannibal2.skyhanni.utils.fromJson import at.hannibal2.skyhanni.utils.renderables.Renderable import com.google.gson.JsonObject -import com.google.gson.reflect.TypeToken +import com.google.gson.TypeAdapter +import com.google.gson.stream.JsonReader +import com.google.gson.stream.JsonWriter import kotlinx.coroutines.launch import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import kotlin.time.Duration.Companion.minutes import kotlin.time.Duration.Companion.seconds class FarmingWeightDisplay { @@ -106,13 +111,13 @@ class FarmingWeightDisplay { private var display = emptyList<Renderable>() private var profileId = "" - private var lastLeaderboardUpdate = 0L + private var lastLeaderboardUpdate = SimpleTimeMark.farPast() private var apiError = false private var leaderboardPosition = -1 private var weight = -1.0 private var localWeight = 0.0 private var weightPerSecond = -1.0 - private var dirtyCropWeight = false + private var weightNeedsRecalculating = false private var isLoadingWeight = false private var isLoadingLeaderboard = false private var rankGoal = -1 @@ -126,6 +131,25 @@ class FarmingWeightDisplay { }) } + private val eliteWeightApiGson by lazy { + ConfigManager.createBaseGsonBuilder() + .registerTypeAdapter(CropType::class.java, object : TypeAdapter<CropType>() { + override fun write(out: JsonWriter, value: CropType) {} + + override fun read(reader: JsonReader): CropType { + return CropType.getByName(reader.nextString()) + } + }.nullSafe()) + .registerTypeAdapter(PestType::class.java, object : TypeAdapter<PestType>() { + override fun write(out: JsonWriter, value: PestType) {} + + override fun read(reader: JsonReader): PestType { + return PestType.getByName(reader.nextString()) + } + }.nullSafe()) + .create() + } + private val errorMessage by lazy { listOf( Renderable.clickAndHover( @@ -199,7 +223,7 @@ class FarmingWeightDisplay { if (!config.leaderboard) return "" // Fetching new leaderboard position every 10.5 minutes - if (System.currentTimeMillis() > lastLeaderboardUpdate + 630_000) { + if (lastLeaderboardUpdate.passedSince() > 10.5.minutes) { loadLeaderboardIfAble() } @@ -212,11 +236,11 @@ class FarmingWeightDisplay { } private fun getWeight(): String { - if (dirtyCropWeight) { + if (weightNeedsRecalculating) { val values = calculateCollectionWeight().values if (values.isNotEmpty()) { localWeight = values.sum() - dirtyCropWeight = false + weightNeedsRecalculating = false } } @@ -321,8 +345,8 @@ class FarmingWeightDisplay { weightPerSecond = -1.0 leaderboardPosition = -1 - dirtyCropWeight = true - lastLeaderboardUpdate = 0 + weightNeedsRecalculating = true + lastLeaderboardUpdate = SimpleTimeMark.farPast() nextPlayers.clear() rankGoal = -1 @@ -353,7 +377,7 @@ class FarmingWeightDisplay { updateWeightPerSecond(crop, before, after, addedCounter) - dirtyCropWeight = true + weightNeedsRecalculating = true } private fun updateWeightPerSecond(crop: CropType, before: Double, after: Double, diff: Int) { @@ -381,7 +405,7 @@ class FarmingWeightDisplay { } GardenAPI.storage?.farmingWeight?.lastFarmingWeightLeaderboard = leaderboardPosition - lastLeaderboardUpdate = System.currentTimeMillis() + lastLeaderboardUpdate = SimpleTimeMark.now() isLoadingLeaderboard = false } } @@ -443,7 +467,7 @@ class FarmingWeightDisplay { private fun toEliteLeaderboardJson(obj: JsonObject): EliteLeaderboardJson { val jsonObject = JsonObject() jsonObject.add("data", obj) - return ConfigManager.gson.fromJson<EliteLeaderboardJson>(jsonObject) + return eliteWeightApiGson.fromJson<EliteLeaderboardJson>(jsonObject) } private fun loadWeight(localProfile: String) { @@ -454,7 +478,8 @@ class FarmingWeightDisplay { var error: Throwable? = null try { - val apiData = ConfigManager.gson.fromJson<EliteWeightJson>(apiResponse) + + val apiData = eliteWeightApiGson.fromJson<ElitePlayerWeightJson>(apiResponse) val selectedProfileId = apiData.selectedProfileId var selectedProfileEntry = apiData.profiles.find { it.profileId == selectedProfileId } @@ -468,7 +493,7 @@ class FarmingWeightDisplay { weight = selectedProfileEntry.totalWeight localCounter.clear() - dirtyCropWeight = true + weightNeedsRecalculating = true return } @@ -517,7 +542,7 @@ class FarmingWeightDisplay { private fun CropType.getLocalCounter() = localCounter[this] ?: 0L private fun CropType.getFactor(): Double { - return factorPerCrop[this] ?: backupFactors[this] ?: error("Crop $this not in backupFactors!") + return cropWeight[this] ?: backupCropWeights[this] ?: error("Crop $this not in backupFactors!") } fun lookUpCommand(it: Array<String>) { @@ -536,24 +561,21 @@ class FarmingWeightDisplay { ChatUtils.chat("Opening Farming Profile of player §b$name") } - private val factorPerCrop = mutableMapOf<CropType, Double>() + private val cropWeight = mutableMapOf<CropType, Double>() private var attemptingCropWeightFetch = false private var hasFetchedCropWeights = false private fun getCropWeights() { if (attemptingCropWeightFetch || hasFetchedCropWeights) return attemptingCropWeightFetch = true - val url = "https://api.elitebot.dev/weights" + val url = "https://api.elitebot.dev/weights/all" val apiResponse = APIUtil.getJSONResponse(url) try { - val apiData = ConfigManager.gson.fromJson<Map<String, Double>>( - apiResponse, - object : TypeToken<Map<String, Double>>() {}.type - ) - for (crop in apiData) { - val cropType = CropType.getByName(crop.key) - factorPerCrop[cropType] = crop.value + val apiData = eliteWeightApiGson.fromJson<EliteWeightsJson>(apiResponse) + apiData.crops + for (crop in apiData.crops) { + cropWeight[crop.key] = crop.value } hasFetchedCropWeights = true } catch (e: Exception) { @@ -565,7 +587,7 @@ class FarmingWeightDisplay { } // still needed when first joining garden and if they cant make https requests - private val backupFactors by lazy { + private val backupCropWeights by lazy { mapOf( CropType.WHEAT to 100_000.0, CropType.CARROT to 302_061.86, diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestType.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestType.kt index 831ce71a7..3525b5e44 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestType.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestType.kt @@ -93,4 +93,13 @@ enum class PestType( "PEST_SLUG_MONSTER".asInternalName(), CropType.MUSHROOM, ), + ; + + companion object { + fun getByNameOrNull(name: String): PestType? { + return PestType.entries.firstOrNull { it.displayName.lowercase() == name } + } + + fun getByName(name: String) = getByNameOrNull(name) ?: error("No valid pest type '$name'") + } } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt index 87a265c84..3d6f0e74e 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/NEUItems.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.utils import at.hannibal2.skyhanni.config.ConfigManager +import at.hannibal2.skyhanni.data.jsonobjects.other.HypixelApiTrophyFish import at.hannibal2.skyhanni.data.jsonobjects.other.HypixelPlayerApiJson import at.hannibal2.skyhanni.data.jsonobjects.repo.MultiFilterJson import at.hannibal2.skyhanni.events.NeuProfileDataLoadedEvent @@ -11,9 +12,14 @@ import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.ItemBlink.checkBlinkItem import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName +import at.hannibal2.skyhanni.utils.NumberUtil.isInt import at.hannibal2.skyhanni.utils.StringUtils.removeColor import com.google.gson.JsonObject import com.google.gson.JsonPrimitive +import com.google.gson.TypeAdapter +import com.google.gson.stream.JsonReader +import com.google.gson.stream.JsonToken +import com.google.gson.stream.JsonWriter import io.github.moulberry.notenoughupdates.NEUManager import io.github.moulberry.notenoughupdates.NEUOverlay import io.github.moulberry.notenoughupdates.NotEnoughUpdates @@ -43,6 +49,37 @@ object NEUItems { private val recipesCache = mutableMapOf<NEUInternalName, Set<NeuRecipe>>() private val ingredientsCache = mutableMapOf<NeuRecipe, Set<Ingredient>>() + private val hypixelApiGson by lazy { + ConfigManager.createBaseGsonBuilder() + .registerTypeAdapter(HypixelApiTrophyFish::class.java, object : TypeAdapter<HypixelApiTrophyFish>() { + override fun write(out: JsonWriter, value: HypixelApiTrophyFish) {} + + override fun read(reader: JsonReader): HypixelApiTrophyFish { + val trophyFish = mutableMapOf<String, Int>() + var totalCaught = 0 + reader.beginObject() + while (reader.hasNext()) { + val key = reader.nextName() + if (key == "total_caught") { + totalCaught = reader.nextInt() + continue + } + if (reader.peek() == JsonToken.NUMBER) { + val valueAsString = reader.nextString() + if (valueAsString.isInt()) { + trophyFish[key] = valueAsString.toInt() + continue + } + } + reader.skipValue() + } + reader.endObject() + return HypixelApiTrophyFish(totalCaught, trophyFish) + } + }.nullSafe()) + .create() + } + var allItemsCache = mapOf<String, NEUInternalName>() // item name -> internal name val allInternalNames = mutableListOf<NEUInternalName>() val ignoreItemsFilter = MultiFilter() @@ -70,7 +107,7 @@ object NEUItems { fun onProfileDataLoaded(event: ProfileDataLoadedEvent) { val apiData = event.data ?: return try { - val playerData = ConfigManager.gson.fromJson<HypixelPlayerApiJson>(apiData) + val playerData = hypixelApiGson.fromJson<HypixelPlayerApiJson>(apiData) NeuProfileDataLoadedEvent(playerData).postAndCatch() } catch (e: Exception) { |