From e740f365ca97e9730e75c214ae7264bde8536bb0 Mon Sep 17 00:00:00 2001 From: Minecon724 Date: Sat, 11 Jun 2022 16:39:34 +0000 Subject: [PATCH] 0.4 --- .../java/pl/minecon724/realweather/realtime/RTTask.java | 7 ++++--- src/main/resources/config.yml | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/pl/minecon724/realweather/realtime/RTTask.java b/src/main/java/pl/minecon724/realweather/realtime/RTTask.java index 092d0cf..184463b 100644 --- a/src/main/java/pl/minecon724/realweather/realtime/RTTask.java +++ b/src/main/java/pl/minecon724/realweather/realtime/RTTask.java @@ -2,6 +2,7 @@ package pl.minecon724.realweather.realtime; import java.time.OffsetDateTime; import java.time.ZoneId; +import java.time.ZonedDateTime; import java.util.ArrayList; import java.util.List; @@ -27,10 +28,10 @@ public class RTTask extends BukkitRunnable { @Override public void run() { - double time = OffsetDateTime.now(timezone).toEpochSecond() / (72 * timeScale) - 18000; - Bukkit.getLogger().info(Double.toString(time)); + long now = ZonedDateTime.now(timezone).toInstant().getEpochSecond(); + double time = now / 72 - 18000; for (World w : worlds) { - w.setTime((long)time); + w.setFullTime((long)time); } } } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index a07eeb2..cb6c5eb 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -43,13 +43,14 @@ provider: # More providers soon! realtime: - enabled: true + enabled: false worlds: - world # "auto" to use server's timezone # Alternatively choose one of these: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List timezone: 'auto' # x day cycles / 24 hrs + # Not implemented yet timeScale: 1.0 # How often should we recalculate the time (in ticks) # Very minimal, if any, impact on performance