From a11d12c0cc4202715ea4305f5bced886d6a7df4f Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 2 Dec 2023 00:30:18 +0100 Subject: Renamed feature and using lastOrNull instead of last to avoid List is empty error. --- .../skyhanni/config/features/inventory/InventoryConfig.java | 2 +- .../features/inventory/ItemDisplayOverlayFeatures.kt | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src/main') diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/inventory/InventoryConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/inventory/InventoryConfig.java index bc333cfb8..60cc0e405 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/inventory/InventoryConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/inventory/InventoryConfig.java @@ -87,7 +87,7 @@ public class InventoryConfig { VACUUM_GARDEN("§bVacuum (Garden)", 14), BOTTLE_OF_JYRRE("§bBottle Of Jyrre", 15), EDITION_NUMBER("§bEdition Number", 16), - SECRET_BINGO_DISCOVERY("§bSecret Bingo Discovery"), + BINGO_GOAL_RANK("§bBingo Goal Rank"), ; private final String str; diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt index f9008713d..5f611a587 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt @@ -4,6 +4,7 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.api.CollectionAPI import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.config.features.inventory.InventoryConfig.ItemNumberEntry +import at.hannibal2.skyhanni.config.features.inventory.InventoryConfig.ItemNumberEntry.BINGO_GOAL_RANK import at.hannibal2.skyhanni.config.features.inventory.InventoryConfig.ItemNumberEntry.BOTTLE_OF_JYRRE import at.hannibal2.skyhanni.config.features.inventory.InventoryConfig.ItemNumberEntry.COLLECTION_LEVEL import at.hannibal2.skyhanni.config.features.inventory.InventoryConfig.ItemNumberEntry.DUNGEON_HEAD_FLOOR_NUMBER @@ -19,7 +20,6 @@ import at.hannibal2.skyhanni.config.features.inventory.InventoryConfig.ItemNumbe import at.hannibal2.skyhanni.config.features.inventory.InventoryConfig.ItemNumberEntry.RANCHERS_BOOTS_SPEED import at.hannibal2.skyhanni.config.features.inventory.InventoryConfig.ItemNumberEntry.SKILL_LEVEL import at.hannibal2.skyhanni.config.features.inventory.InventoryConfig.ItemNumberEntry.VACUUM_GARDEN -import at.hannibal2.skyhanni.config.features.inventory.InventoryConfig.ItemNumberEntry.SECRET_BINGO_DISCOVERY import at.hannibal2.skyhanni.events.RenderItemTipEvent import at.hannibal2.skyhanni.features.garden.pests.PestAPI import at.hannibal2.skyhanni.utils.ConfigUtils @@ -52,7 +52,7 @@ object ItemDisplayOverlayFeatures { private val gardenVacuumPatterm = "§7Vacuum Bag: §6(?\\d*) Pests?".toPattern() private val harvestPattern = "§7§7You may harvest §6(?.).*".toPattern() private val dungeonPotionPattern = "Dungeon (?.*) Potion".toPattern() - private val secretBingoDiscoveryPattern = "(§.)*You were the (§.)*(?[\\w]+)(?(st|nd|rd|th)) (§.)*to".toPattern() + private val bingoGoalRankPattern = "(§.)*You were the (§.)*(?[\\w]+)(?(st|nd|rd|th)) (§.)*to".toPattern() private val bottleOfJyrre = "NEW_BOTTLE_OF_JYRRE".asInternalName() @@ -224,11 +224,11 @@ object ItemDisplayOverlayFeatures { } } - if (SECRET_BINGO_DISCOVERY.isSelected() && chestName == "Bingo Card" && item.getLore().last() == "§aGOAL REACHED") { + if (BINGO_GOAL_RANK.isSelected() && chestName == "Bingo Card" && item.getLore().lastOrNull() == "§aGOAL REACHED") { for (line in item.getLore()) { - secretBingoDiscoveryPattern.matchMatcher(line) { - val nth = group("nth").formatNumber() - if (nth < 10000) return "${NumberUtil.format(nth)}" + bingoGoalRankPattern.matchMatcher(line) { + val rank = group("rank").formatNumber() + if (rank < 10000) return "§6${NumberUtil.format(rank)}" } } } -- cgit