aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-11-15 14:00:35 +0100
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-11-15 14:00:35 +0100
commitd091756ac7696e2c5880a3edabcb36deeca8333f (patch)
tree6d191d041f018e5e2026a788f8caa7d525fc4c2f /src/main/java
parent32ff726edba446405e0cc7315e7d87b6fa1cd03f (diff)
downloadskyhanni-d091756ac7696e2c5880a3edabcb36deeca8333f.tar.gz
skyhanni-d091756ac7696e2c5880a3edabcb36deeca8333f.tar.bz2
skyhanni-d091756ac7696e2c5880a3edabcb36deeca8333f.zip
Fixed calendar contest detection failing.
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt12
1 files changed, 4 insertions, 8 deletions
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 3254e685b..9a9e9c1d3 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt
@@ -44,7 +44,7 @@ object GardenNextJacobContest {
private var inCalendar = false
private val patternDay = "§aDay (?<day>.*)".toPattern()
private val patternMonth = "(?<month>.*), Year (?<year>.*)".toPattern()
- private val patternCrop = "§e○ §7(?<crop>.*)".toPattern()
+ private val patternCrop = "§(e○|6☘) §7(?<crop>.*)".toPattern()
private const val maxContestsPerYear = 124
private const val contestDuration = 1_000 * 60 * 20
@@ -146,17 +146,13 @@ object GardenNextJacobContest {
if (!lore.any { it.contains("§6§eJacob's Farming Contest") }) continue
val name = item.name ?: continue
- val matcherDay = patternDay.matcher(name)
- if (!matcherDay.matches()) continue
+ val day = patternDay.matchMatcher(name) { group("day").toInt() } ?: continue
- val day = matcherDay.group("day").toInt()
val startTime = SkyBlockTime(year, month, day).toMillis()
val crops = mutableListOf<CropType>()
for (line in lore) {
- val matcherCrop = patternCrop.matcher(line)
- if (!matcherCrop.matches()) continue
- crops.add(CropType.getByName(matcherCrop.group("crop")))
+ patternCrop.matchMatcher(line) { crops.add(CropType.getByName(group("crop"))) }
}
contests[startTime] = FarmingContest(startTime + contestDuration, crops)
@@ -513,4 +509,4 @@ object GardenNextJacobContest {
event.move(3, "garden.nextJacobContestWarnPopup", "garden.nextJacobContests.warnPopup")
event.move(3, "garden.nextJacobContestPos", "garden.nextJacobContests.pos")
}
-} \ No newline at end of file
+}