From c77c747858d94c99a236f8a28bfce1af83dea60d Mon Sep 17 00:00:00 2001 From: Mykyta Komarnytskyy Date: Thu, 25 Feb 2021 08:28:16 -0800 Subject: [PATCH] Use pose check instead of Player::isSleeping checks This may potentially resolve some issues with plugins that allow you to "lay" on the ground to sleep. --- src/main/java/xyz/nkomarn/harbor/task/Checker.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/xyz/nkomarn/harbor/task/Checker.java b/src/main/java/xyz/nkomarn/harbor/task/Checker.java index 0e142a9..b0519f3 100644 --- a/src/main/java/xyz/nkomarn/harbor/task/Checker.java +++ b/src/main/java/xyz/nkomarn/harbor/task/Checker.java @@ -7,6 +7,7 @@ import org.bukkit.configuration.ConfigurationSection; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; +import org.bukkit.entity.Pose; import org.bukkit.metadata.MetadataValue; import org.bukkit.scheduler.BukkitRunnable; import org.jetbrains.annotations.NotNull; @@ -159,7 +160,7 @@ public class Checker extends BukkitRunnable { @NotNull public List getSleepingPlayers(@NotNull World world) { return world.getPlayers().stream() - .filter(Player::isSleeping) + .filter(player -> player.getPose() == Pose.SLEEPING) .collect(toList()); }