From 49c6139d99b96f793a96d4e1f4b6ce06ee95122f Mon Sep 17 00:00:00 2001 From: Minecon724 Date: Thu, 5 Dec 2024 20:32:39 +0100 Subject: [PATCH] Fix instant sleep --- src/main/java/eu/m724/tweaks/sleep/SleepListener.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/eu/m724/tweaks/sleep/SleepListener.java b/src/main/java/eu/m724/tweaks/sleep/SleepListener.java index 3a7a27d..6e0c23c 100644 --- a/src/main/java/eu/m724/tweaks/sleep/SleepListener.java +++ b/src/main/java/eu/m724/tweaks/sleep/SleepListener.java @@ -39,7 +39,7 @@ public class SleepListener implements Listener { if (!skippedCurrentNight.contains(event.getPlayer())) { double onePlayerRatio = 1 / (event.getPlayer().getServer().getOnlinePlayers().size() * (world.getGameRuleValue(GameRule.PLAYERS_SLEEPING_PERCENTAGE) / 100.0)); - world.setTime((long) ((23459 - world.getTime()) * onePlayerRatio)); + world.setTime(Math.min(world.getTime() + (long) (10917 * onePlayerRatio), 23459)); skippedCurrentNight.add(event.getPlayer()); } }