From a425f95998893cf2dbeca4deb80df3a9dfb1c466 Mon Sep 17 00:00:00 2001 From: CalMWolfs <94038482+CalMWolfs@users.noreply.github.com> Date: Fri, 24 May 2024 20:24:55 +1000 Subject: Fix: Calendar pattern (#1871) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../skyhanni/features/garden/GardenNextJacobContest.kt | 15 +++++++++------ .../garden/contest/JacobFarmingContestsInventory.kt | 1 + 2 files changed, 10 insertions(+), 6 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt index 05668871f..0bfc9c87b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt @@ -28,7 +28,6 @@ import at.hannibal2.skyhanni.utils.SimpleTimeMark.Companion.asTimeMark import at.hannibal2.skyhanni.utils.SkyBlockTime import at.hannibal2.skyhanni.utils.SoundUtils import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher -import at.hannibal2.skyhanni.utils.StringUtils.matches import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.TabListData import at.hannibal2.skyhanni.utils.TimeUtils.format @@ -67,9 +66,16 @@ object GardenNextJacobContest { "day", "§aDay (?.*)" ) + + /** + * REGEX-TEST: Early Spring, Year 351 + * REGEX-TEST: Late Summer, Year 351 + * REGEX-TEST: Autumn, Year 351 + */ + val monthPattern by patternGroup.pattern( "month", - "(?.*), Year (?.*)" + "(?(?:\\w+ )?(?:Summer|Spring|Winter|Autumn)), Year (?\\d+)" ) private val cropPattern by patternGroup.pattern( "crop", @@ -187,11 +193,8 @@ object GardenNextJacobContest { @SubscribeEvent fun onInventoryOpen(event: InventoryFullyOpenedEvent) { if (!config.display) return - if (!monthPattern.matches(event.inventoryName)) return - - inCalendar = true - monthPattern.matchMatcher(event.inventoryName) { + inCalendar = true val month = LorenzUtils.getSBMonthByName(group("month")) val year = group("year").toInt() diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobFarmingContestsInventory.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobFarmingContestsInventory.kt index 72d3c6975..8cdde229f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobFarmingContestsInventory.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobFarmingContestsInventory.kt @@ -82,6 +82,7 @@ class JacobFarmingContestsInventory { @SubscribeEvent fun onSlotClick(event: GuiContainerEvent.SlotClickEvent) { + // TODO add tooltip line "click + press to open on elite website if (!config.openOnElite.isKeyHeld()) return if (!LorenzUtils.inSkyBlock) return -- cgit