diff options
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/misc/ServerRestartTitle.kt | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/ServerRestartTitle.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/ServerRestartTitle.kt index fc83bdfb4..73b003ef6 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/ServerRestartTitle.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ServerRestartTitle.kt @@ -5,9 +5,10 @@ import at.hannibal2.skyhanni.data.ScoreboardData import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher -import at.hannibal2.skyhanni.utils.TimeUtils +import at.hannibal2.skyhanni.utils.TimeUtils.format import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import kotlin.time.Duration.Companion.minutes import kotlin.time.Duration.Companion.seconds class ServerRestartTitle { @@ -28,11 +29,11 @@ class ServerRestartTitle { for (line in ScoreboardData.sidebarLinesFormatted) { restartPattern.matchMatcher(line) { - val minutes = group("minutes").toInt() - val seconds = group("seconds").toInt() - val totalSeconds = minutes * 60 + seconds - if (totalSeconds > 120 && totalSeconds % 30 != 0) return - val time = TimeUtils.formatDuration(totalSeconds.toLong() * 1000) + val minutes = group("minutes").toInt().minutes + val seconds = group("seconds").toInt().seconds + val totalTime = minutes + seconds + if (totalTime > 2.minutes && totalTime.inWholeSeconds % 30 != 0L) return + val time = totalTime.format() LorenzUtils.sendTitle("§cServer Restart in §b$time", 2.seconds) } } |