diff options
Diffstat (limited to 'patch-remap/mache-spigotflower-stripped/net/minecraft/server/players/SleepStatus.java.patch')
-rw-r--r-- | patch-remap/mache-spigotflower-stripped/net/minecraft/server/players/SleepStatus.java.patch | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower-stripped/net/minecraft/server/players/SleepStatus.java.patch b/patch-remap/mache-spigotflower-stripped/net/minecraft/server/players/SleepStatus.java.patch new file mode 100644 index 0000000000..580cdaf078 --- /dev/null +++ b/patch-remap/mache-spigotflower-stripped/net/minecraft/server/players/SleepStatus.java.patch @@ -0,0 +1,48 @@ +--- a/net/minecraft/server/players/SleepStatus.java ++++ b/net/minecraft/server/players/SleepStatus.java +@@ -17,10 +17,13 @@ + return this.sleepingPlayers >= this.sleepersNeeded(i); + } + +- public boolean areEnoughDeepSleeping(int i, List<ServerPlayer> list) { +- int j = (int) list.stream().filter(Player::isSleepingLongEnough).count(); ++ public boolean areEnoughDeepSleeping(int requiredSleepPercentage, List<ServerPlayer> sleepingPlayers) { ++ // CraftBukkit start ++ int j = (int) sleepingPlayers.stream().filter((eh) -> { return eh.isSleepingLongEnough() || eh.fauxSleeping; }).count(); ++ boolean anyDeepSleep = sleepingPlayers.stream().anyMatch(Player::isSleepingLongEnough); + +- return j >= this.sleepersNeeded(i); ++ return anyDeepSleep && j >= this.sleepersNeeded(requiredSleepPercentage); ++ // CraftBukkit end + } + + public int sleepersNeeded(int i) { +@@ -41,19 +44,25 @@ + + this.activePlayers = 0; + this.sleepingPlayers = 0; +- Iterator iterator = list.iterator(); ++ Iterator iterator = players.iterator(); ++ boolean anySleep = false; // CraftBukkit + + while (iterator.hasNext()) { + ServerPlayer serverplayer = (ServerPlayer) iterator.next(); + + if (!serverplayer.isSpectator()) { + ++this.activePlayers; +- if (serverplayer.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 + } + } |