From 79d0cd3af5b2acf11fc63bc3aa6743f784a3a0f6 Mon Sep 17 00:00:00 2001 From: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> Date: Fri, 7 Jun 2024 22:10:11 +1000 Subject: Backend: Change Java to Kotlin for repo files (#1543) --- .../at/hannibal2/skyhanni/features/fishing/FishingAPI.kt | 4 ++-- .../skyhanni/features/fishing/SeaCreatureManager.kt | 12 ++++++------ .../skyhanni/features/fishing/trophy/TrophyFishManager.kt | 13 ++----------- 3 files changed, 10 insertions(+), 19 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/features/fishing') diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingAPI.kt index aaf7db8a7..89beae6aa 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/FishingAPI.kt @@ -120,8 +120,8 @@ object FishingAPI { @SubscribeEvent fun onRepoReload(event: RepositoryReloadEvent) { val data = event.getConstant("Items") - lavaRods = data.lava_fishing_rods - waterRods = data.water_fishing_rods + lavaRods = data.lavaFishingRods + waterRods = data.waterFishingRods } private fun getAllowedBlocks() = if (holdingLavaRod) lavaBlocks else waterBlocks diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureManager.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureManager.kt index 59d9d818b..5f7499574 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/SeaCreatureManager.kt @@ -35,20 +35,20 @@ class SeaCreatureManager { allFishingMobs = emptyMap() var counter = 0 - val data = event.getConstant>("SeaCreatures", SeaCreatureJson.TYPE) + val data = event.getConstant>("SeaCreatures", SeaCreatureJson.TYPE) val allFishingMobs = mutableMapOf() val variants = mutableMapOf>() for ((variantName, variant) in data) { - val chatColor = variant.chat_color + val chatColor = variant.chatColor val variantFishes = mutableListOf() variants[variantName] = variantFishes - for ((name, seaCreature) in variant.sea_creatures) { - val chatMessage = seaCreature.chat_message - val fishingExperience = seaCreature.fishing_experience + for ((name, seaCreature) in variant.seaCreatures) { + val chatMessage = seaCreature.chatMessage + val fishingExperience = seaCreature.fishingExperience val rarity = seaCreature.rarity - val rare = seaCreature.rare ?: false + val rare = seaCreature.rare val creature = SeaCreature(name, fishingExperience, chatColor, rare, rarity) seaCreatureMap[chatMessage] = creature diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishManager.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishManager.kt index 2b3a59032..44893f949 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishManager.kt @@ -2,8 +2,8 @@ package at.hannibal2.skyhanni.features.fishing.trophy import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.ProfileStorageData +import at.hannibal2.skyhanni.data.jsonobjects.repo.TrophyFishInfo import at.hannibal2.skyhanni.data.jsonobjects.repo.TrophyFishJson -import at.hannibal2.skyhanni.data.jsonobjects.repo.TrophyFishJson.TrophyFishInfo import at.hannibal2.skyhanni.events.NeuProfileDataLoadedEvent import at.hannibal2.skyhanni.events.RepositoryReloadEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule @@ -21,7 +21,7 @@ object TrophyFishManager { @SubscribeEvent fun onRepoReload(event: RepositoryReloadEvent) { val data = event.getConstant("TrophyFish") - trophyFishInfo = data.trophy_fish + trophyFishInfo = data.trophyFish } val fish: MutableMap>? @@ -87,15 +87,6 @@ object TrophyFishManager { fun getInfoByName(name: String) = trophyFishInfo.values.find { it.displayName == name } fun TrophyFishInfo.getFilletValue(rarity: TrophyRarity): Int { - if (fillet == null) { - ErrorManager.logErrorStateWithData( - "Error trying to read trophy fish info", - "fillet in TrophyFishInfo is null", - "displayName" to displayName, - "TrophyFishInfo" to this, - ) - return -1 - } return fillet.getOrDefault(rarity, -1) } -- cgit