From d1a9b5b3ea2a4a140fc1aa34db3ad8a79822391c Mon Sep 17 00:00:00 2001 From: "Erymanthus[#5074] | (u/)RayDeeUx" <51521765+RayDeeUx@users.noreply.github.com> Date: Sat, 14 Oct 2023 08:00:41 -0400 Subject: Addition: Ingame time GUI element (#503) Added In-Game Date Display. #503 --- src/main/java/at/hannibal2/skyhanni/utils/LorenzUtils.kt | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/main/java/at/hannibal2/skyhanni/utils') 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 -- cgit