From 8f51992d70390d8ff6f32e0e8497dc509d886054 Mon Sep 17 00:00:00 2001 From: Risto Lahtela <24460436+Rsl1122@users.noreply.github.com> Date: Sun, 3 May 2020 12:04:53 +0300 Subject: [PATCH] Fixed plan_sessions_recent_peak_date placeholder Affects issues: - Fixed #1408 --- .../com/djrapitops/plan/placeholder/SessionPlaceHolders.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Plan/common/src/main/java/com/djrapitops/plan/placeholder/SessionPlaceHolders.java b/Plan/common/src/main/java/com/djrapitops/plan/placeholder/SessionPlaceHolders.java index 1f2af32a8..d67082c0a 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/placeholder/SessionPlaceHolders.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/placeholder/SessionPlaceHolders.java @@ -34,6 +34,7 @@ import javax.inject.Inject; import javax.inject.Singleton; import java.io.Serializable; import java.util.UUID; +import java.util.concurrent.TimeUnit; import java.util.function.Supplier; import static com.djrapitops.plan.utilities.MiscUtils.*; @@ -212,10 +213,10 @@ public class SessionPlaceHolders implements Placeholders { () -> database.query(TPSQueries.fetchAllTimePeakPlayerCount(serverUUID)).map(year).orElse("-")); placeholders.registerStatic("sessions_recent_peak_count", - () -> database.query(TPSQueries.fetchPeakPlayerCount(serverUUID, dayAgo() * 2L)).map(DateObj::getValue).orElse(0)); + () -> database.query(TPSQueries.fetchPeakPlayerCount(serverUUID, now() - TimeUnit.DAYS.toMillis(2L))).map(DateObj::getValue).orElse(0)); placeholders.registerStatic("sessions_recent_peak_date", - () -> database.query(TPSQueries.fetchPeakPlayerCount(serverUUID, dayAgo() * 2L)).map(year).orElse("-")); + () -> database.query(TPSQueries.fetchPeakPlayerCount(serverUUID, now() - TimeUnit.DAYS.toMillis(2L))).map(year).orElse("-")); } private static String getPlaytime(Database database, long after, long before, UUID serverUUID, Formatter timeAmount) {