aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/limbo/LimboPlaytime.kt20
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/limbo/LimboTimeTracker.kt15
2 files changed, 29 insertions, 6 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/limbo/LimboPlaytime.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/limbo/LimboPlaytime.kt
index cf0da4b6c..b232b837d 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/limbo/LimboPlaytime.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/limbo/LimboPlaytime.kt
@@ -137,10 +137,22 @@ class LimboPlaytime {
minutesList: MutableList<String>,
hoursList: MutableList<String>,
) {
- val firstLine = toolTip.first()
- val totalPlaytime = toolTip.last()
+ val firstList = mutableListOf<String>()
+ val lastList = mutableListOf<String>()
+ var hasPassed = false
+ toolTip.forEach {
+ if (!(hoursPattern.matches(it) || minutesPattern.matches(it)) && !hasPassed) {
+ firstList.add(it)
+ } else hasPassed = true
+ }
+ hasPassed = false
+ toolTip.forEach {
+ if (!(hoursPattern.matches(it) || minutesPattern.matches(it)) && hasPassed) {
+ lastList.add(it)
+ } else hasPassed = true
+ }
toolTip.clear()
- toolTip.add(firstLine)
+ toolTip.addAll(firstList)
if (!setMinutes) {
toolTip.addAll(modifiedList)
toolTip.addAll(minutesList)
@@ -148,7 +160,7 @@ class LimboPlaytime {
toolTip.addAll(hoursList)
toolTip.addAll(modifiedList)
}
- toolTip.add(totalPlaytime)
+ toolTip.addAll(lastList)
}
private fun findFloatDecimalPlace(input: Float): Int {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/limbo/LimboTimeTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/limbo/LimboTimeTracker.kt
index e39736326..9e9a9113f 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/limbo/LimboTimeTracker.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/limbo/LimboTimeTracker.kt
@@ -147,8 +147,13 @@ object LimboTimeTracker {
val currentPB = storage?.personalBest ?: 0
val userLuck = storage?.userLuck ?: 0f
val limboPB: Int = if (currentPB < timeInLimbo) timeInLimbo else currentPB
- ChatUtils.chat("§fYour current PB is §e${limboPB.seconds}§f, granting you §a+${userLuck.round(2)}✴ SkyHanni User Luck§f!")
- ChatUtils.chat("§fYou have §e${playtime.seconds} §fof playtime!")
+ var luckString = tryTruncateFloat(userLuck.round(2))
+ if (userLuck > 0) luckString = "+$luckString"
+ var firstMessage = "§fYour current PB is §e${limboPB.seconds}§f, granting you §a$luckString✴ SkyHanni User Luck§f!"
+ val secondMessage = "§fYou have §e${playtime.seconds} §fof playtime!"
+ if ((userLuck == Float.POSITIVE_INFINITY) || (userLuck == Float.NEGATIVE_INFINITY)) firstMessage = "$firstMessage §Zwhat"
+ ChatUtils.chat(firstMessage)
+ ChatUtils.chat(secondMessage)
}
}
@@ -189,4 +194,10 @@ object LimboTimeTracker {
}
fun isEnabled() = config.showTimeInLimbo
+
+ private fun tryTruncateFloat(input: Float): String {
+ val string = input.toString()
+ return if (string.endsWith(".0")) return string.dropLast(2)
+ else string
+ }
}