aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/og/net/minecraft/server/players/SleepStatus.patch
diff options
context:
space:
mode:
authorMiniDigger | Martin <[email protected]>2024-01-14 11:04:49 +0100
committerMiniDigger | Martin <[email protected]>2024-01-14 11:04:49 +0100
commitbee74680e607c2e29b038329f62181238911cd83 (patch)
tree708fd1a4a0227d9071243adf2a42d5e9e96cde4a /patch-remap/og/net/minecraft/server/players/SleepStatus.patch
parent0a44692ef6ff6e255d48eb3ba1bb114166eafda9 (diff)
downloadPaper-softspoon.tar.gz
Paper-softspoon.zip
add remapped patches as a testsoftspoon
Diffstat (limited to 'patch-remap/og/net/minecraft/server/players/SleepStatus.patch')
-rw-r--r--patch-remap/og/net/minecraft/server/players/SleepStatus.patch44
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
+ }
+ }