mirror of
https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git
synced 2024-11-25 05:46:13 +00:00
45 lines
1.7 KiB
Diff
45 lines
1.7 KiB
Diff
--- a/net/minecraft/server/players/SleepStatus.java
|
|
+++ b/net/minecraft/server/players/SleepStatus.java
|
|
@@ -18,9 +18,12 @@
|
|
}
|
|
|
|
public boolean areEnoughDeepSleeping(int i, List<EntityPlayer> list) {
|
|
- int j = (int) list.stream().filter(EntityHuman::isSleepingLongEnough).count();
|
|
+ // CraftBukkit start
|
|
+ int j = (int) list.stream().filter((eh) -> { return eh.isSleepingLongEnough() || eh.fauxSleeping; }).count();
|
|
+ boolean anyDeepSleep = list.stream().anyMatch(EntityHuman::isSleepingLongEnough);
|
|
|
|
- return j >= this.sleepersNeeded(i);
|
|
+ return anyDeepSleep && j >= this.sleepersNeeded(i);
|
|
+ // CraftBukkit end
|
|
}
|
|
|
|
public int sleepersNeeded(int i) {
|
|
@@ -42,18 +45,24 @@
|
|
this.activePlayers = 0;
|
|
this.sleepingPlayers = 0;
|
|
Iterator iterator = list.iterator();
|
|
+ boolean anySleep = false; // CraftBukkit
|
|
|
|
while (iterator.hasNext()) {
|
|
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
|
|
|
|
if (!entityplayer.isSpectator()) {
|
|
++this.activePlayers;
|
|
- if (entityplayer.isSleeping()) {
|
|
+ if (entityplayer.isSleeping() || entityplayer.fauxSleeping) { // CraftBukkit
|
|
++this.sleepingPlayers;
|
|
}
|
|
+ // CraftBukkit start
|
|
+ if (entityplayer.isSleeping()) {
|
|
+ anySleep = true;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
}
|
|
}
|
|
|
|
- return (j > 0 || this.sleepingPlayers > 0) && (i != this.activePlayers || j != this.sleepingPlayers);
|
|
+ return anySleep && (j > 0 || this.sleepingPlayers > 0) && (i != this.activePlayers || j != this.sleepingPlayers); // CraftBukkit
|
|
}
|
|
}
|