diff options
Diffstat (limited to 'patch-remap/og/net/minecraft/server/players/SleepStatus.patch')
-rw-r--r-- | patch-remap/og/net/minecraft/server/players/SleepStatus.patch | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/patch-remap/og/net/minecraft/server/players/SleepStatus.patch b/patch-remap/og/net/minecraft/server/players/SleepStatus.patch new file mode 100644 index 0000000000..3af51ebff8 --- /dev/null +++ b/patch-remap/og/net/minecraft/server/players/SleepStatus.patch @@ -0,0 +1,44 @@ +--- 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 + } + } |