summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft/server
diff options
context:
space:
mode:
authorsk89q <the.sk89q@gmail.com>2011-04-11 11:48:31 -0700
committersk89q <the.sk89q@gmail.com>2011-04-11 11:48:31 -0700
commit86c467cb50c3fabf48838b0d5c213e277fc49a8d (patch)
treece1e51d9f04809e07c88d9e38991b3b47a739f4a /src/main/java/net/minecraft/server
parent2685de187a3e4352c554e5362c1a835952e0016f (diff)
downloadcraftbukkit-86c467cb50c3fabf48838b0d5c213e277fc49a8d.tar
craftbukkit-86c467cb50c3fabf48838b0d5c213e277fc49a8d.tar.gz
craftbukkit-86c467cb50c3fabf48838b0d5c213e277fc49a8d.tar.lz
craftbukkit-86c467cb50c3fabf48838b0d5c213e277fc49a8d.tar.xz
craftbukkit-86c467cb50c3fabf48838b0d5c213e277fc49a8d.zip
Fixin' the problem of AFK people not in bed.
Diffstat (limited to 'src/main/java/net/minecraft/server')
-rw-r--r--src/main/java/net/minecraft/server/EntityHuman.java1
-rw-r--r--src/main/java/net/minecraft/server/World.java28
2 files changed, 26 insertions, 3 deletions
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index 84631ee2..50835358 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -37,6 +37,7 @@ public abstract class EntityHuman extends EntityLiving {
public double y;
// CraftBukkit start
public boolean sleeping;
+ public boolean fauxSleeping;
// CraftBukkit end
private ChunkCoordinates b;
// CraftBukkit start
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 7686f62b..28f24db1 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1808,13 +1808,25 @@ public class World implements IBlockAccess {
while (iterator.hasNext()) {
EntityHuman entityhuman = (EntityHuman) iterator.next();
- if (!entityhuman.F()) {
+ // CraftBukkit start
+ if (!entityhuman.F() && !entityhuman.fauxSleeping) {
+ // CraftBukkit end
this.A = false;
break;
}
}
}
+ // CraftBukkit start
+ // Calls the method that checks to see if players are sleeping
+ // Called by CraftPlayer.setPermanentSleeping()
+ public void checkSleepStatus() {
+ if (!isStatic) {
+ q();
+ }
+ }
+ // CraftBukkit end
+
protected void r() {
this.A = false;
Iterator iterator = this.d.iterator();
@@ -1831,16 +1843,26 @@ public class World implements IBlockAccess {
public boolean s() {
if (this.A && !this.isStatic) {
Iterator iterator = this.d.iterator();
+
+ // CraftBukkit start
+ boolean foundActualSleepers = false;
+
+ // This allows us to assume that some people are in bed
+ // but not really, allowing time to pass in spite of AFKers
EntityHuman entityhuman;
do {
if (!iterator.hasNext()) {
- return true;
+ return foundActualSleepers;
}
entityhuman = (EntityHuman) iterator.next();
- } while (entityhuman.G());
+ if (entityhuman.G()) {
+ foundActualSleepers = true;
+ }
+ } while (entityhuman.G() || entityhuman.fauxSleeping);
+ // CraftBukkit end
return false;
} else {