aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/utils
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-10-17 13:11:40 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-10-17 13:11:40 +0200
commitd144ade0173c4d5cdefae948f1f62d929cb56e55 (patch)
treeab28caec243366d5cf1f6a722d3fa1eb1cc46a9e /src/main/java/at/hannibal2/skyhanni/utils
parent86777a6f592b7b9a97d6a1491296c044c8942104 (diff)
downloadskyhanni-d144ade0173c4d5cdefae948f1f62d929cb56e55.tar.gz
skyhanni-d144ade0173c4d5cdefae948f1f62d929cb56e55.tar.bz2
skyhanni-d144ade0173c4d5cdefae948f1f62d929cb56e55.zip
fixed test error
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt15
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt16
2 files changed, 16 insertions, 15 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
index 355473c9e..d53dd4d1b 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt
@@ -108,21 +108,6 @@ object LorenzUtils {
fun SimpleDateFormat.formatCurrentTime(): String = this.format(System.currentTimeMillis())
- fun SkyBlockTime.formatted(): String {
- val hour = if (this.hour > 12) this.hour - 12 else this.hour
- val timeOfDay = if (this.hour > 11) "pm" else "am" // hooray for 12-hour clocks
- var minute = this.minute.toString()
- if (minute.length != 2) {
- minute = minute.padStart(2, '0')
- }
-
- val month = SkyBlockTime.monthName(this.month)
- val day = this.day
- val daySuffix = SkyBlockTime.daySuffix(day)
- val year = this.year
- return "$month $day$daySuffix, Year $year $hour:${minute}$timeOfDay" // Early Winter 1st Year 300, 12:03pm
- }
-
fun stripVanillaMessage(originalMessage: String): String {
var message = originalMessage
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt
index 3f78c7a3b..33a9bbe83 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt
@@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.utils
import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
+import io.github.moulberry.notenoughupdates.util.SkyBlockTime
import kotlin.time.Duration
object TimeUtils {
@@ -117,6 +118,21 @@ object TimeUtils {
}
}.toLong()
}
+
+ fun SkyBlockTime.formatted(): String {
+ val hour = if (this.hour > 12) this.hour - 12 else this.hour
+ val timeOfDay = if (this.hour > 11) "pm" else "am" // hooray for 12-hour clocks
+ var minute = this.minute.toString()
+ if (minute.length != 2) {
+ minute = minute.padStart(2, '0')
+ }
+
+ val month = SkyBlockTime.monthName(this.month)
+ val day = this.day
+ val daySuffix = SkyBlockTime.daySuffix(day)
+ val year = this.year
+ return "$month $day$daySuffix, Year $year $hour:${minute}$timeOfDay" // Early Winter 1st Year 300, 12:03pm
+ }
}
private const val FACTOR_SECONDS = 1000L