From 6d39abe56c7185d1975ea3a8259e23a5a5634861 Mon Sep 17 00:00:00 2001 From: Minecon724 Date: Sun, 9 Jun 2024 13:23:23 +0200 Subject: [PATCH] fixed player time --- .../eu/m724/realweather/time/AsyncPlayerTimeTask.java | 6 ++++-- src/main/resources/plugin.yml | 8 ++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main/java/eu/m724/realweather/time/AsyncPlayerTimeTask.java b/src/main/java/eu/m724/realweather/time/AsyncPlayerTimeTask.java index 36d1ea0..23d54ba 100644 --- a/src/main/java/eu/m724/realweather/time/AsyncPlayerTimeTask.java +++ b/src/main/java/eu/m724/realweather/time/AsyncPlayerTimeTask.java @@ -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); } } diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 85e55d9..1820a50 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -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