aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorThunderblade73 <85900443+Thunderblade73@users.noreply.github.com>2023-09-29 21:16:26 +0200
committerGitHub <noreply@github.com>2023-09-29 21:16:26 +0200
commitb66076544f322159308570ae8c238d9f49a8b5d2 (patch)
tree2cb382378932eaa70cfdda78a3052082436edf40 /src/main
parent80cca037bbdf961ae92365c538a38b419412e7b8 (diff)
downloadskyhanni-b66076544f322159308570ae8c238d9f49a8b5d2.tar.gz
skyhanni-b66076544f322159308570ae8c238d9f49a8b5d2.tar.bz2
skyhanni-b66076544f322159308570ae8c238d9f49a8b5d2.zip
Added toggle for 12hr/24hr in real time hud (#511)
Added toggle for 12hr/24hr in real time hud #511
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/GUIConfig.java5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/TimeFeatures.kt6
2 files changed, 9 insertions, 2 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/GUIConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/GUIConfig.java
index 2015415b0..370254665 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/GUIConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/GUIConfig.java
@@ -60,6 +60,11 @@ public class GUIConfig {
public boolean realTime = false;
@Expose
+ @ConfigOption(name = "Real Time 12h Format", desc = "Display the current computer time in 12hr Format rather than 24h Format.")
+ @ConfigEditorBoolean
+ public boolean realTimeFormatToggle = false;
+
+ @Expose
public Position realTimePosition = new Position(10, 10, false, true);
@Expose
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/TimeFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/TimeFeatures.kt
index 4f23411a0..6e6aa029f 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/TimeFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/TimeFeatures.kt
@@ -20,7 +20,8 @@ class TimeFeatures {
private val config get() = SkyHanniMod.feature.gui
private val winterConfig get() = SkyHanniMod.feature.event.winter
- private val format = SimpleDateFormat("HH:mm:ss")
+ private val timeFormat24h = SimpleDateFormat("HH:mm:ss")
+ private val timeFormat12h = SimpleDateFormat("hh:mm:ss a")
private val startOfNextYear = RecalculatingValue(1.seconds) {
SkyBlockTime(year = SkyBlockTime.now().year + 1).asTimeMark()
@@ -31,7 +32,8 @@ class TimeFeatures {
if (!LorenzUtils.inSkyBlock) return
if (config.realTime) {
- config.realTimePosition.renderString(format.format(System.currentTimeMillis()), posLabel = "Real Time")
+ val currentTime = (if (config.realTimeFormatToggle) timeFormat12h else timeFormat24h).format(System.currentTimeMillis())
+ config.realTimePosition.renderString(currentTime, posLabel = "Real Time")
}
if (winterConfig.islandCloseTime && IslandType.WINTER.isInIsland()) {