1
0
mirror of https://github.com/nkomarn/harbor.git synced 2025-01-07 00:08:19 +01:00

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

View File

@ -7,6 +7,7 @@ import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.Pose;
import org.bukkit.metadata.MetadataValue; import org.bukkit.metadata.MetadataValue;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -159,7 +160,7 @@ public class Checker extends BukkitRunnable {
@NotNull @NotNull
public List<Player> getSleepingPlayers(@NotNull World world) { public List<Player> getSleepingPlayers(@NotNull World world) {
return world.getPlayers().stream() return world.getPlayers().stream()
.filter(Player::isSleeping) .filter(player -> player.getPose() == Pose.SLEEPING)
.collect(toList()); .collect(toList());
} }