aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-11-21 21:06:19 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-11-21 21:06:19 +0100
commit16b914abed6e58f2a89be04560f649b0353da318 (patch)
tree82e9b77a470d6abf008c67ed656ee5671bec94f1 /src/main/java
parent6965c72c60ed68ee2fea4b0249f1cec463c4ac8b (diff)
downloadskyhanni-16b914abed6e58f2a89be04560f649b0353da318.tar.gz
skyhanni-16b914abed6e58f2a89be04560f649b0353da318.tar.bz2
skyhanni-16b914abed6e58f2a89be04560f649b0353da318.zip
Fixed farming contest summary not showing when the crop is buffed by Anita Talisman/Ring/Artifact.
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/contest/FarmingContestAPI.kt17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/FarmingContestAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/FarmingContestAPI.kt
index c5bb8d2a8..33335c4ab 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/FarmingContestAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/FarmingContestAPI.kt
@@ -11,6 +11,7 @@ import at.hannibal2.skyhanni.features.garden.GardenAPI
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.addOrPut
+import at.hannibal2.skyhanni.utils.LorenzUtils.nextAfter
import at.hannibal2.skyhanni.utils.LorenzUtils.sortedDesc
import at.hannibal2.skyhanni.utils.SimpleTimeMark
import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
@@ -26,7 +27,7 @@ object FarmingContestAPI {
var inContest = false
var contestCrop: CropType? = null
private var startTime = SimpleTimeMark.farPast()
- private val sidebarCropPattern = "§e○ §f(?<crop>.*) §a.*".toPattern()
+ private val sidebarCropPattern = "(?:§e○|§6☘) §f(?<crop>.*) §a.*".toPattern()
var inInventory = false
@@ -69,17 +70,9 @@ object FarmingContestAPI {
}
private fun readCurrentCrop(): CropType? {
- var next = false
- for (line in ScoreboardData.sidebarLinesFormatted) {
- if (line == "§eJacob's Contest") {
- next = true
- continue
- }
- if (next) {
- sidebarCropPattern.matchMatcher(line) {
- return CropType.getByName(group("crop"))
- }
- }
+ val line = ScoreboardData.sidebarLinesFormatted.nextAfter("§eJacob's Contest") ?: return null
+ sidebarCropPattern.matchMatcher(line) {
+ return CropType.getByName(group("crop"))
}
return null