Skip to content

Commit

Permalink
fix(timer): fix duplicate calculate duration
Browse files Browse the repository at this point in the history
  • Loading branch information
StarWishsama committed Mar 31, 2024
1 parent fac61a0 commit 3035066
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/main/java/city/norain/slimefun4/utils/SimpleTimer.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ public Duration duration() {
}

public String durationStr() {
var duration = duration();
return String.format("%d:%02d:%02d", duration.toHours(), duration.toMinutesPart(), duration.toSecondsPart());
if (snapshot == null) {
snapshot = duration();
}

return String.format("%d:%02d:%02d", snapshot.toHours(), snapshot.toMinutesPart(), snapshot.toSecondsPart());
}

public boolean isTimeout(Duration duration) {
Expand Down

0 comments on commit 3035066

Please sign in to comment.