aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2
diff options
context:
space:
mode:
authorLuna <me@lunya.dev>2024-09-04 11:19:12 +0200
committerGitHub <noreply@github.com>2024-09-04 11:19:12 +0200
commit461fa9c4ece3a85b9cac7f7247fcc0c71a4a31e3 (patch)
tree20b554b12eda8310a3e181ea6ade1cb57d290a92 /src/main/java/at/hannibal2
parentc13744021e4ba9ddcba42a5635bde8a5d2617292 (diff)
downloadskyhanni-461fa9c4ece3a85b9cac7f7247fcc0c71a4a31e3.tar.gz
skyhanni-461fa9c4ece3a85b9cac7f7247fcc0c71a4a31e3.tar.bz2
skyhanni-461fa9c4ece3a85b9cac7f7247fcc0c71a4a31e3.zip
Improvement: Allow turning off exact minutes on custom scoreboard (#2443)
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/gui/customscoreboard/DisplayConfig.java5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt5
3 files changed, 15 insertions, 2 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/gui/customscoreboard/DisplayConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/gui/customscoreboard/DisplayConfig.java
index e2c6dd6fa..0d61401ee 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/gui/customscoreboard/DisplayConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/gui/customscoreboard/DisplayConfig.java
@@ -130,6 +130,11 @@ public class DisplayConfig {
public boolean skyblockTime24hFormat = false;
@Expose
+ @ConfigOption(name = "SkyBlock Time Exact Minutes", desc = "Display the exact minutes in the SkyBlock time, rather than only 10 minute increments.")
+ @ConfigEditorBoolean
+ public boolean skyblockTimeExactMinutes = true;
+
+ @Expose
@ConfigOption(name = "Line Spacing", desc = "The amount of space between each line.")
@ConfigEditorSlider(minValue = 0, maxValue = 20, minStep = 1)
public int lineSpacing = 10;
diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt
index 5753a6fd6..a58a7efc4 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt
@@ -577,7 +577,12 @@ private fun getTimeDisplayPair(): List<ScoreboardElementType> {
getGroupFromPattern(CustomScoreboard.activeLines, ScoreboardPattern.timePattern, "symbol") ?: ""
return listOf(
"ยง7" + SkyBlockTime.now()
- .formatted(dayAndMonthElement = false, yearElement = false, timeFormat24h = config.display.skyblockTime24hFormat) +
+ .formatted(
+ dayAndMonthElement = false,
+ yearElement = false,
+ timeFormat24h = config.display.skyblockTime24hFormat,
+ exactMinutes = config.display.skyblockTimeExactMinutes,
+ ) +
" $symbol" to HorizontalAlignment.LEFT,
)
}
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt
index 201c294e5..b31bb828b 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/TimeUtils.kt
@@ -105,12 +105,15 @@ object TimeUtils {
yearElement: Boolean = true,
hoursAndMinutesElement: Boolean = true,
timeFormat24h: Boolean = false,
+ exactMinutes: Boolean = true,
): String {
val hour = if (timeFormat24h) this.hour else (this.hour + 11) % 12 + 1
val timeOfDay = if (!timeFormat24h) {
if (this.hour > 11) "pm" else "am"
} else ""
- val minute = this.minute.toString().padStart(2, '0')
+ val minute = this.minute.let {
+ if (exactMinutes) it else it - (it % 10)
+ }.toString().padStart(2, '0')
val month = SkyBlockTime.monthName(this.month)
val day = this.day
val daySuffix = SkyBlockTime.daySuffix(day)