removed ignoreSleep as it was causing more problems than it solves

This commit is contained in:
Louis Vallat 2020-06-14 17:05:52 +02:00
parent 0c6261973c
commit 9ab6362e97

View File

@ -36,7 +36,6 @@ 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);
@ -49,6 +48,5 @@ 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);
}
}