aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at
diff options
context:
space:
mode:
authorContrabass <83555891+Contrabass26@users.noreply.github.com>2023-07-25 15:04:41 +0100
committerGitHub <noreply@github.com>2023-07-25 16:04:41 +0200
commit973e95ea5d9c0bba381548c5af04fd2ced713925 (patch)
tree0b17eb2e752ad6be8f5113834aaec21f024c67a3 /src/main/java/at
parent579a7bb51ce867ee15adea5a4c3dc823a7272b64 (diff)
downloadskyhanni-973e95ea5d9c0bba381548c5af04fd2ced713925.tar.gz
skyhanni-973e95ea5d9c0bba381548c5af04fd2ced713925.tar.bz2
skyhanni-973e95ea5d9c0bba381548c5af04fd2ced713925.zip
Merge pull request #99
* Fixed calendar reading going above 100 percent
Diffstat (limited to 'src/main/java/at')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt36
1 files changed, 19 insertions, 17 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 2a5a3bbf1..3a7e2bc15 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt
@@ -112,24 +112,26 @@ class GardenNextJacobContest {
}
}
- for (item in items) {
- val lore = item.getLore()
- 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 = 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")))
+ if (contests.size < maxContestsPerYear) {
+ for (item in items) {
+ val lore = item.getLore()
+ 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 = 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")))
+ }
+ val contest = FarmingContest(startTime + contestDuration, crops)
+ contests[startTime] = contest
}
- val contest = FarmingContest(startTime + contestDuration, crops)
- contests[startTime] = contest
}
update()