Skip to content

Commit ce28be8

Browse files
committed
Fix #70
This fixes the thunderstorm looping bug by forcing players out of bed immediately and only removing the world from the skipping queue after 20 ticks.
1 parent 130953b commit ce28be8

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

src/main/java/xyz/nkomarn/harbor/task/AccelerateNightTask.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import org.bukkit.Bukkit;
44
import org.bukkit.Statistic;
55
import org.bukkit.World;
6+
import org.bukkit.entity.LivingEntity;
67
import org.bukkit.scheduler.BukkitRunnable;
78
import org.jetbrains.annotations.NotNull;
89
import xyz.nkomarn.harbor.Harbor;
@@ -53,9 +54,15 @@ public void run() {
5354
world.getPlayers().forEach(player -> player.setStatistic(Statistic.TIME_SINCE_REST, 0));
5455
}
5556

56-
checker.resetStatus(world);
57-
harbor.getPlayerManager().clearCooldowns();
58-
harbor.getMessages().sendRandomChatMessage(world, "messages.chat.night-skipped");
57+
world.getPlayers().stream()
58+
.filter(LivingEntity::isSleeping)
59+
.forEach(player -> player.wakeup(true));
60+
61+
harbor.getServer().getScheduler().runTaskLater(harbor, () -> {
62+
checker.resetStatus(world);
63+
harbor.getPlayerManager().clearCooldowns();
64+
harbor.getMessages().sendRandomChatMessage(world, "messages.chat.night-skipped");
65+
}, 20L);
5966
cancel();
6067
return;
6168
}

0 commit comments

Comments
 (0)