fixed player time

This commit is contained in:
Minecon724 2024-06-09 13:23:23 +02:00
parent 3afe2ede2b
commit 6d39abe56c
Signed by: Minecon724
GPG key ID: 3CCC4D267742C8E8
2 changed files with 10 additions and 4 deletions

View file

@ -27,10 +27,12 @@ public class AsyncPlayerTimeTask extends BukkitRunnable {
public void run() {
for (Player player : server.getOnlinePlayers()) {
if (!player.hasPermission("realweather.dynamic")) continue;
if (!mapper.getWorlds().contains(player.getWorld())) continue;
Coordinates coordinates = mapper.locationToCoordinates(player.getLocation());
long offsetTicks = (long) ((coordinates.longitude / 15) * 1000 * timeConfig.scale);
player.setPlayerTime(offsetTicks, true); // TODO can this be negative?
long offsetTicks = timeConfig.calculateTimeOffsetTicks(coordinates.longitude);
player.setPlayerTime(Math.floorMod(offsetTicks, 24000), true);
DebugLogger.info("Time for %s: %d", 2, player.getName(), offsetTicks);
}
}

View file

@ -26,11 +26,12 @@ commands:
permission-message: You do not have permission to use this command.
permissions:
# Commands
realweather.command:
description: Allows /realweather (individual nodes are still necessary for subcommands)
realweather.command.status:
description: /realweather status
realweather.command.*:
description: All /realweather commands
children:
@ -42,15 +43,18 @@ permissions:
default: true
realweather.geo.tp:
description: Allows teleportation using /geo
realweather.localtime:
description: Allows /localtime
default: true
# Engine
realweather.dynamic:
description: Includes player in dynamic conditions
default: true
# Other
realweather.actionbar:
description: Displays status on player's action bar