1
0
mirror of https://github.com/nkomarn/harbor.git synced 2024-11-22 01:45:47 +01:00
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.
This commit is contained in:
Mykyta Komarnytskyy 2020-11-10 10:33:51 -08:00
parent 130953b216
commit ce28be83ad

View File

@ -3,6 +3,7 @@ package xyz.nkomarn.harbor.task;
import org.bukkit.Bukkit;
import org.bukkit.Statistic;
import org.bukkit.World;
import org.bukkit.entity.LivingEntity;
import org.bukkit.scheduler.BukkitRunnable;
import org.jetbrains.annotations.NotNull;
import xyz.nkomarn.harbor.Harbor;
@ -53,9 +54,15 @@ public class AccelerateNightTask extends BukkitRunnable {
world.getPlayers().forEach(player -> player.setStatistic(Statistic.TIME_SINCE_REST, 0));
}
world.getPlayers().stream()
.filter(LivingEntity::isSleeping)
.forEach(player -> player.wakeup(true));
harbor.getServer().getScheduler().runTaskLater(harbor, () -> {
checker.resetStatus(world);
harbor.getPlayerManager().clearCooldowns();
harbor.getMessages().sendRandomChatMessage(world, "messages.chat.night-skipped");
}, 20L);
cancel();
return;
}