From 0360ada84992e9852c79c30119045e2fc16c522e Mon Sep 17 00:00:00 2001 From: EpicKnarvik97 Date: Thu, 4 Apr 2024 23:54:48 +0200 Subject: [PATCH] Adds two decimals to best time placeholders --- .../minigames/arena/record/LongRecord.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/net/knarcraft/minigames/arena/record/LongRecord.java b/src/main/java/net/knarcraft/minigames/arena/record/LongRecord.java index aacc012..547a2fd 100644 --- a/src/main/java/net/knarcraft/minigames/arena/record/LongRecord.java +++ b/src/main/java/net/knarcraft/minigames/arena/record/LongRecord.java @@ -31,17 +31,17 @@ public class LongRecord extends SummableArenaRecord { @Override public String getAsString() { - int seconds = (int) Math.floor(getRecord() / 1000.0); - int minutes = 0; + double seconds = getRecord() / 1000.0; + double minutes = 0; if (seconds > 60) { - minutes = (int) Math.floor(seconds / 60.0); + minutes = seconds / 60.0; seconds = seconds % 60; } if (minutes > 0) { - return minutes + "m" + seconds + "s"; + return String.format("%.0fm%.2fs", minutes, seconds); } else { - return seconds + "s"; + return String.format("%.2fs", seconds); } } @@ -53,7 +53,8 @@ public class LongRecord extends SummableArenaRecord { */ @SuppressWarnings("unused") public static LongRecord deserialize(@NotNull Map data) { - return new LongRecord(((SerializableUUID) data.get("userId")).getRawValue(), ((Number) data.get("record")).longValue()); + return new LongRecord(((SerializableUUID) data.get("userId")).getRawValue(), + ((Number) data.get("record")).longValue()); } }