From fc8d82ca5e95d13bcd2205406f1ddcf9e525eb6d Mon Sep 17 00:00:00 2001 From: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> Date: Wed, 10 Apr 2024 17:18:35 +1000 Subject: Backend: Remove some more deprecated functions and misc code cleanup (#1402) Co-authored-by: Empa <42304516+ItsEmpa@users.noreply.github.com> Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../features/bingo/card/BingoCardDisplay.kt | 10 ++-- .../skyhanni/features/chat/PlayerDeathMessages.kt | 8 ++- .../features/dungeon/CroesusChestTracker.kt | 22 ++++----- .../event/diana/InquisitorWaypointShare.kt | 9 ++-- .../features/event/winter/NewYearCakeReminder.kt | 29 ++++------- .../features/fame/AccountUpgradeReminder.kt | 12 ++--- .../skyhanni/features/fame/CityProjectFeatures.kt | 19 +++----- .../skyhanni/features/fishing/TotemOfCorruption.kt | 14 +++--- .../features/garden/AtmosphericFilterDisplay.kt | 5 +- .../features/garden/FarmingFortuneDisplay.kt | 4 +- .../features/garden/GardenNextJacobContest.kt | 34 ++++++------- .../composter/GardenComposterInventoryFeatures.kt | 20 +++++--- .../features/garden/farming/ArmorDropTracker.kt | 9 ++-- .../features/garden/farming/CropMoneyDisplay.kt | 4 +- .../garden/farming/FarmingWeightDisplay.kt | 18 ++++--- .../garden/farming/GardenCropMilestoneDisplay.kt | 2 +- .../visitor/HighlightVisitorsOutsideOfGarden.kt | 5 +- .../itemabilities/abilitycooldown/ItemAbility.kt | 3 +- .../skyhanni/features/mining/KingTalismanHelper.kt | 5 +- .../mining/eventtracker/MiningEventTracker.kt | 5 +- .../skyhanni/features/misc/ServerRestartTitle.kt | 57 ++++++++-------------- .../features/misc/items/EstimatedItemValue.kt | 2 +- .../misc/items/EstimatedItemValueCalculator.kt | 3 +- .../features/misc/items/EstimatedWardrobePrice.kt | 3 +- .../dailyquest/DailyQuestHelper.kt | 4 +- .../area/livingcave/LivingCaveDefenseBlocks.kt | 8 ++- .../area/livingcave/LivingMetalSuitProgress.kt | 5 +- .../area/stillgorechateau/RiftBloodEffigies.kt | 22 ++++----- .../rift/area/westvillage/kloon/KloonHacking.kt | 8 ++- .../rift/everywhere/CruxTalismanDisplay.kt | 4 +- .../features/slayer/blaze/BlazeSlayerClearView.kt | 35 +++++++------ .../slayer/enderman/EndermanSlayerFeatures.kt | 5 +- 32 files changed, 171 insertions(+), 222 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/features') diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardDisplay.kt index e1cd1dbca..9fca47fbc 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardDisplay.kt @@ -4,7 +4,7 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.GuiRenderEvent -import at.hannibal2.skyhanni.events.LorenzTickEvent +import at.hannibal2.skyhanni.events.SecondPassedEvent import at.hannibal2.skyhanni.events.bingo.BingoCardUpdateEvent import at.hannibal2.skyhanni.features.bingo.BingoAPI import at.hannibal2.skyhanni.features.bingo.card.goals.BingoGoal @@ -71,11 +71,9 @@ class BingoCardDisplay { } @SubscribeEvent - fun onTick(event: LorenzTickEvent) { - if (event.repeatSeconds(1)) { - if (hasHiddenPersonalGoals) { - update() - } + fun onSecondPassed(event: SecondPassedEvent) { + if (hasHiddenPersonalGoals) { + update() } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerDeathMessages.kt b/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerDeathMessages.kt index f44185c4c..2823d57d9 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerDeathMessages.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/chat/PlayerDeathMessages.kt @@ -2,8 +2,8 @@ package at.hannibal2.skyhanni.features.chat import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.LorenzChatEvent -import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.features.dungeon.DungeonAPI +import at.hannibal2.skyhanni.events.SecondPassedEvent import at.hannibal2.skyhanni.features.misc.MarkedPlayerManager import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.EntityUtils @@ -27,12 +27,10 @@ class PlayerDeathMessages { ) @SubscribeEvent - fun onTick(event: LorenzTickEvent) { + fun onSecondPassed(event: SecondPassedEvent) { if (!isHideFarDeathsEnabled()) return - if (event.repeatSeconds(1)) { - checkOtherPlayers() - } + checkOtherPlayers() } @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusChestTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusChestTracker.kt index ea94117af..176a40f59 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusChestTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/dungeon/CroesusChestTracker.kt @@ -34,19 +34,19 @@ class CroesusChestTracker { private val config get() = SkyHanniMod.feature.dungeon.chest - private val repoGroup = RepoPattern.group("dungeon.croesus") + private val patternGroup = RepoPattern.group("dungeon.croesus") - private val croesusPattern by repoGroup.pattern("inventory", "Croesus") - private val croesusEmptyPattern by repoGroup.pattern("empty", "§cNo treasures!") - private val kismetPattern by repoGroup.pattern("kismet.reroll", "§aReroll Chest") - private val kismetUsedPattern by repoGroup.pattern("kismet.used", "§aYou already rerolled a chest!") + private val croesusPattern by patternGroup.pattern("inventory", "Croesus") + private val croesusEmptyPattern by patternGroup.pattern("empty", "§cNo treasures!") + private val kismetPattern by patternGroup.pattern("kismet.reroll", "§aReroll Chest") + private val kismetUsedPattern by patternGroup.pattern("kismet.used", "§aYou already rerolled a chest!") - private val floorPattern by repoGroup.pattern("chest.floor", "§7Tier: §eFloor (?[IV]+)") - private val masterPattern by repoGroup.pattern("chest.master", ".*Master.*") + private val floorPattern by patternGroup.pattern("chest.floor", "§7Tier: §eFloor (?[IV]+)") + private val masterPattern by patternGroup.pattern("chest.master", ".*Master.*") - private val keyUsedPattern by repoGroup.pattern("chest.state.keyused", "§aNo more Chests to open!") - private val openedPattern by repoGroup.pattern("chest.state.opened", "§8Opened Chest:.*") - private val unopenedPattern by repoGroup.pattern("chest.state.unopened", "§8No Chests Opened!") + private val keyUsedPattern by patternGroup.pattern("chest.state.keyused", "§aNo more Chests to open!") + private val openedPattern by patternGroup.pattern("chest.state.opened", "§8Opened Chest:.*") + private val unopenedPattern by patternGroup.pattern("chest.state.unopened", "§8No Chests Opened!") private val kismetSlotId = 50 private val emptySlotId = 22 @@ -115,7 +115,7 @@ class CroesusChestTracker { private fun kismetDungeonChestSetup(event: InventoryFullyOpenedEvent) { chestInventory = DungeonChest.getByInventoryName(event.inventoryName) ?: return if (config.kismetStackSize) { - kismetAmountCache = getKismetAmount().toInt() + kismetAmountCache = getKismetAmount() } if (config.showUsedKismets) { val kismetItem = event.inventoryItems[kismetSlotId] ?: return diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt index 42a4c8850..33f7efab4 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/InquisitorWaypointShare.kt @@ -4,9 +4,9 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.EntityHealthUpdateEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzKeyPressEvent -import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent import at.hannibal2.skyhanni.events.PacketEvent +import at.hannibal2.skyhanni.events.SecondPassedEvent import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy import at.hannibal2.skyhanni.utils.EntityUtils @@ -84,15 +84,14 @@ object InquisitorWaypointShare { } @SubscribeEvent - fun onTick(event: LorenzTickEvent) { + fun onSecondPassed(event: SecondPassedEvent) { if (!isEnabled()) return if (event.repeatSeconds(3)) { inquisitorsNearby = inquisitorsNearby.editCopy { removeIf { it.isDead } } } - if (event.repeatSeconds(1)) { - waypoints = waypoints.editCopy { values.removeIf { it.spawnTime.passedSince() > 75.seconds } } - } + + waypoints = waypoints.editCopy { values.removeIf { it.spawnTime.passedSince() > 75.seconds } } } @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/winter/NewYearCakeReminder.kt b/src/main/java/at/hannibal2/skyhanni/features/event/winter/NewYearCakeReminder.kt index 4bc6c02b5..9a68947dc 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/winter/NewYearCakeReminder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/winter/NewYearCakeReminder.kt @@ -2,10 +2,10 @@ package at.hannibal2.skyhanni.features.event.winter import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.data.ProfileStorageData +import at.hannibal2.skyhanni.data.ScoreboardData import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.LorenzChatEvent -import at.hannibal2.skyhanni.events.LorenzTickEvent -import at.hannibal2.skyhanni.events.ScoreboardChangeEvent +import at.hannibal2.skyhanni.events.SecondPassedEvent import at.hannibal2.skyhanni.features.fame.ReminderUtils import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.LorenzUtils @@ -23,14 +23,12 @@ class NewYearCakeReminder { "event.winter.newyearcake.reminder.sidebar", "§dNew Year Event!§f (?