aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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()