From 42f51938e314f8686c10a81f3313c21001eeca09 Mon Sep 17 00:00:00 2001 From: Mykyta Komarnytskyy Date: Mon, 30 Nov 2020 08:23:08 -0800 Subject: [PATCH] Fix proportional acceleration speed calculation --- .../java/xyz/nkomarn/harbor/task/AccelerateNightTask.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/xyz/nkomarn/harbor/task/AccelerateNightTask.java b/src/main/java/xyz/nkomarn/harbor/task/AccelerateNightTask.java index 38c44e0..7a97068 100644 --- a/src/main/java/xyz/nkomarn/harbor/task/AccelerateNightTask.java +++ b/src/main/java/xyz/nkomarn/harbor/task/AccelerateNightTask.java @@ -45,8 +45,8 @@ public class AccelerateNightTask extends BukkitRunnable { int dayTime = Math.max(150, config.getInteger("night-skip.daytime-ticks")); int sleeping = checker.getSleepingPlayers(world).size(); - if (config.getBoolean("night-skip.proportional-acceleration") && sleeping != 0) { - timeRate = Math.min(timeRate, Math.round(timeRate / world.getPlayers().size() * sleeping)); + if (config.getBoolean("night-skip.proportional-acceleration")) { + timeRate = Math.min(timeRate, Math.round(timeRate / world.getPlayers().size() * Math.max(1, sleeping))); } if (time >= (dayTime - timeRate * 1.5) && time <= dayTime) {