diff --git a/src/main/java/xyz/louisvallat/sweetdreams/SweetDreams.java b/src/main/java/xyz/louisvallat/sweetdreams/SweetDreams.java index 3e6efe7..5765512 100644 --- a/src/main/java/xyz/louisvallat/sweetdreams/SweetDreams.java +++ b/src/main/java/xyz/louisvallat/sweetdreams/SweetDreams.java @@ -36,6 +36,7 @@ public final class SweetDreams extends JavaPlugin implements Listener { final Player player = event.getPlayer(); final World world = player.getWorld(); if (event.getBedEnterResult() == PlayerBedEnterEvent.BedEnterResult.OK) { + player.setSleepingIgnored(true); sleepingSchedulers.put(player, this.getServer().getScheduler().scheduleSyncDelayedTask(this, () -> { if (world.isThundering()) world.setThundering(false); else world.setTime(1000); @@ -48,5 +49,6 @@ public final class SweetDreams extends JavaPlugin implements Listener { @EventHandler(priority = EventPriority.LOWEST) public void onWake(PlayerBedLeaveEvent event) { this.getServer().getScheduler().cancelTask(sleepingSchedulers.get(event.getPlayer())); + event.getPlayer().setSleepingIgnored(false); } }