diff options
author | Contrabass <83555891+Contrabass26@users.noreply.github.com> | 2023-07-25 15:04:41 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-25 16:04:41 +0200 |
commit | 973e95ea5d9c0bba381548c5af04fd2ced713925 (patch) | |
tree | 0b17eb2e752ad6be8f5113834aaec21f024c67a3 /src/main | |
parent | 579a7bb51ce867ee15adea5a4c3dc823a7272b64 (diff) | |
download | skyhanni-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')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/garden/GardenNextJacobContest.kt | 36 |
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() |