File tree Expand file tree Collapse file tree
src/main/java/xyz/nkomarn/harbor/task Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33import org .bukkit .Bukkit ;
44import org .bukkit .Statistic ;
55import org .bukkit .World ;
6+ import org .bukkit .entity .LivingEntity ;
67import org .bukkit .scheduler .BukkitRunnable ;
78import org .jetbrains .annotations .NotNull ;
89import 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 }
You can’t perform that action at this time.
0 commit comments