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.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);
}
}
}

View file

@ -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