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.
This commit is contained in:
Mykyta Komarnytskyy 2021-02-25 08:28:16 -08:00
parent 67fdfa05b4
commit c77c747858
1 changed files with 2 additions and 1 deletions

View File

@ -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<Player> getSleepingPlayers(@NotNull World world) {
return world.getPlayers().stream()
.filter(Player::isSleeping)
.filter(player -> player.getPose() == Pose.SLEEPING)
.collect(toList());
}