Skip to content

Commit

Permalink
Fix #70
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
nkomarn committed Nov 10, 2020
1 parent 130953b commit ce28be8
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/main/java/xyz/nkomarn/harbor/task/AccelerateNightTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
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;
Expand Down Expand Up @@ -53,9 +54,15 @@ public void run() {
world.getPlayers().forEach(player -> player.setStatistic(Statistic.TIME_SINCE_REST, 0));
}

checker.resetStatus(world);
harbor.getPlayerManager().clearCooldowns();
harbor.getMessages().sendRandomChatMessage(world, "messages.chat.night-skipped");
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;
}
Expand Down

0 comments on commit ce28be8

Please sign in to comment.