aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/contest/ContestBracket.kt (renamed from src/main/java/at/hannibal2/skyhanni/features/garden/contest/ContestRank.kt)2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/contest/FarmingContest.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/contest/FarmingContestAPI.kt18
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestFFNeededDisplay.kt14
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestTimeNeeded.kt4
5 files changed, 20 insertions, 20 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/ContestRank.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/ContestBracket.kt
index 5bae5ef0d..4218f0e41 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/ContestRank.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/ContestBracket.kt
@@ -1,6 +1,6 @@
package at.hannibal2.skyhanni.features.garden.contest
-enum class ContestRank(val color: String) {
+enum class ContestBracket(val color: String) {
GOLD("6"),
SILVER("f"),
BRONZE("c"),
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/FarmingContest.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/FarmingContest.kt
index 03fb4b0a8..5bf2da85c 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/FarmingContest.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/FarmingContest.kt
@@ -2,4 +2,4 @@ package at.hannibal2.skyhanni.features.garden.contest
import at.hannibal2.skyhanni.features.garden.CropType
-data class FarmingContest(val time: Long, val crop: CropType, val ranks: Map<ContestRank, Int>) \ No newline at end of file
+data class FarmingContest(val time: Long, val crop: CropType, val brackets: Map<ContestBracket, Int>) \ No newline at end of file
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 3f943d037..a9f05f615 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
@@ -55,29 +55,29 @@ object FarmingContestAPI {
cropPattern.matchMatcher(it) { CropType.getByName(group("crop")) }
} ?: error("Crop not found in lore!")
- val ranks = ContestRank.values().associateWith { rank ->
+ val brackets = ContestBracket.values().associateWith { bracket ->
lore.firstNotNullOfOrNull {
- rank.pattern.matchMatcher(it) {
+ bracket.pattern.matchMatcher(it) {
group("amount").replace(",", "").toInt()
}
- } ?: error("Farming contest rank not found in lore!")
+ } ?: error("Farming contest bracket not found in lore!")
}
- return FarmingContest(time, crop, ranks)
+ return FarmingContest(time, crop, brackets)
}
fun getContestAtTime(time: Long) = contests[time]
fun getContestsOfType(crop: CropType) = contests.values.filter { it.crop == crop }
- fun calculateAverages(crop: CropType): Pair<Int, Map<ContestRank, Int>> {
+ fun calculateAverages(crop: CropType): Pair<Int, Map<ContestBracket, Int>> {
var amount = 0
- val map = mutableMapOf<ContestRank, Int>()
+ val map = mutableMapOf<ContestBracket, Int>()
for (contest in getContestsOfType(crop).associateWith { it.time }.sortedDesc().keys) {
amount++
- for ((rank, count) in contest.ranks) {
- val old = map.getOrDefault(rank, 0)
- map[rank] = count + old
+ for ((bracket, count) in contest.brackets) {
+ val old = map.getOrDefault(bracket, 0)
+ map[bracket] = count + old
}
if (amount == 10) break
}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestFFNeededDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestFFNeededDisplay.kt
index 7e45a9fe3..cd8295ebe 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestFFNeededDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestFFNeededDisplay.kt
@@ -59,15 +59,15 @@ class JacobContestFFNeededDisplay {
val crop = contest.crop
add(listOf("§7For this ", crop.icon, "§7${crop.cropName} contest:"))
- for (rank in ContestRank.values()) {
- addAsSingletonList(getLine(rank, contest.ranks, crop))
+ for (bracket in ContestBracket.values()) {
+ addAsSingletonList(getLine(bracket, contest.brackets, crop))
}
addAsSingletonList("")
val (size, averages) = FarmingContestAPI.calculateAverages(crop)
add(listOf("§7For the last §e$size ", crop.icon, "§7${crop.cropName} contests:"))
- for (rank in ContestRank.values()) {
- addAsSingletonList(getLine(rank, averages, crop))
+ for (bracket in ContestBracket.values()) {
+ addAsSingletonList(getLine(bracket, averages, crop))
}
addAsSingletonList("")
@@ -107,12 +107,12 @@ class JacobContestFFNeededDisplay {
return ceil(ff).addSeparators()
}
- private fun getLine(rank: ContestRank, map: Map<ContestRank, Int>, crop: CropType): String {
- val counter = map[rank]!!
+ private fun getLine(bracket: ContestBracket, map: Map<ContestBracket, Int>, crop: CropType): String {
+ val counter = map[bracket]!!
val blocksPerSecond = crop.getLatestBlocksPerSecond() ?: 20.0
val cropsPerSecond = counter.toDouble() / blocksPerSecond / 60
val farmingFortune = formatFarmingFortune(cropsPerSecond * 100 / 20 / crop.baseDrops)
- return " ${rank.displayName}§f: §6$farmingFortune FF §7(${counter.addSeparators()} crops)"
+ return " ${bracket.displayName}§f: §6$farmingFortune FF §7(${counter.addSeparators()} crops)"
}
@SubscribeEvent
diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestTimeNeeded.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestTimeNeeded.kt
index 94498ed69..c63f01069 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestTimeNeeded.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/contest/JacobContestTimeNeeded.kt
@@ -22,7 +22,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class JacobContestTimeNeeded {
private val config get() = SkyHanniMod.feature.garden
private var display = listOf<List<Any>>()
- private var currentBracket = ContestRank.GOLD
+ private var currentBracket = ContestBracket.GOLD
@SubscribeEvent(priority = EventPriority.LOW)
fun onLateInventoryOpen(event: LateInventoryOpenEvent) {
@@ -97,7 +97,7 @@ class JacobContestTimeNeeded {
this.display = buildList {
addAsSingletonList("§e§lTime Needed for ${currentBracket.displayName} §eMedal!")
- addSelector("§7Bracket: ", ContestRank.values(),
+ addSelector("§7Bracket: ", ContestBracket.values(),
getName = { type -> type.name.lowercase() },
isCurrent = { it == currentBracket },
onChange = {