diff options
author | Erymanthus[#5074] | (u/)RayDeeUx <51521765+RayDeeUx@users.noreply.github.com> | 2023-10-14 08:00:41 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-14 14:00:41 +0200 |
commit | d1a9b5b3ea2a4a140fc1aa34db3ad8a79822391c (patch) | |
tree | 01be443e27c247e858c921318a354e5f00dbc601 /src/main/java/at/hannibal2/skyhanni/utils | |
parent | 7a634386ec4dd842e946bd3ba331c0d565faf173 (diff) | |
download | skyhanni-d1a9b5b3ea2a4a140fc1aa34db3ad8a79822391c.tar.gz skyhanni-d1a9b5b3ea2a4a140fc1aa34db3ad8a79822391c.tar.bz2 skyhanni-d1a9b5b3ea2a4a140fc1aa34db3ad8a79822391c.zip |
Addition: Ingame time GUI element (#503)
Added In-Game Date Display. #503
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt index 2559e31dd..5dc578856 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt @@ -108,6 +108,18 @@ object LorenzUtils { fun SimpleDateFormat.formatCurrentTime(): String = this.format(System.currentTimeMillis()) + fun SkyBlockTime.getFormattedSkyblockTime(): String { + val date: SkyBlockTime = SkyBlockTime.now() + val hour = if (date.hour > 12) date.hour - 12 else date.hour + val timeOfDay = if (date.hour > 11) "pm" else "am" // hooray for 12-hour clocks + var minute = date.minute.toString() + if (minute.length != 2) { + minute = minute.padStart(2,'0') + } + + return "${SkyBlockTime.monthName(date.month)} ${date.day}${SkyBlockTime.daySuffix(date.day)}, Year ${date.year} $hour:${minute}$timeOfDay" // Early Winter 1st Year 300, 12:03pm + } + fun stripVanillaMessage(originalMessage: String): String { var message = originalMessage |