This commit is contained in:
Minecon724 2022-06-11 16:39:34 +00:00
parent 4e3f04ee79
commit e740f365ca
2 changed files with 6 additions and 4 deletions

View file

@ -2,6 +2,7 @@ package pl.minecon724.realweather.realtime;
import java.time.OffsetDateTime; import java.time.OffsetDateTime;
import java.time.ZoneId; import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -27,10 +28,10 @@ public class RTTask extends BukkitRunnable {
@Override @Override
public void run() { public void run() {
double time = OffsetDateTime.now(timezone).toEpochSecond() / (72 * timeScale) - 18000; long now = ZonedDateTime.now(timezone).toInstant().getEpochSecond();
Bukkit.getLogger().info(Double.toString(time)); double time = now / 72 - 18000;
for (World w : worlds) { for (World w : worlds) {
w.setTime((long)time); w.setFullTime((long)time);
} }
} }
} }

View file

@ -43,13 +43,14 @@ provider:
# More providers soon! # More providers soon!
realtime: realtime:
enabled: true enabled: false
worlds: worlds:
- world - world
# "auto" to use server's timezone # "auto" to use server's timezone
# Alternatively choose one of these: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List # Alternatively choose one of these: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List
timezone: 'auto' timezone: 'auto'
# x day cycles / 24 hrs # x day cycles / 24 hrs
# Not implemented yet
timeScale: 1.0 timeScale: 1.0
# How often should we recalculate the time (in ticks) # How often should we recalculate the time (in ticks)
# Very minimal, if any, impact on performance # Very minimal, if any, impact on performance