diff options
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 |