From 164c06645343579406a8497d14c93427923d8b61 Mon Sep 17 00:00:00 2001 From: Travis Watkins Date: Sun, 5 Aug 2012 23:45:38 -0500 Subject: [PATCH] Fix "moved too quickly" detection. --- .../java/net/minecraft/server/EntityHuman.java | 8 -------- .../java/net/minecraft/server/EntityPlayer.java | 2 ++ .../net/minecraft/server/NetServerHandler.java | 15 +++++++-------- 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java index 2b09abc560..0b02f5b7f0 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java @@ -950,14 +950,6 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen } public void a(boolean flag, boolean flag1, boolean flag2) { - if (this.fauxSleeping && !this.sleeping) return; // CraftBukkit - Can't leave bed if not in one! - - // CraftBukkit start - moved check from packet19 handler TODO: make sure this works before turning on - // if (this instanceof EntityPlayer) { - // ((EntityPlayer) this).netServerHandler.checkMovement = false; - // } - // CraftBukkit end - this.a(0.6F, 1.8F); this.d_(); ChunkCoordinates chunkcoordinates = this.bT; diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java index bffdca798c..b8696b58c8 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java @@ -431,6 +431,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } public void a(boolean flag, boolean flag1, boolean flag2) { + if (this.fauxSleeping && !this.sleeping) return; // CraftBukkit - Can't leave bed if not in one! + if (this.isSleeping()) { this.q().getTracker().sendPacketToEntity(this, new Packet18ArmAnimation(this, 3)); } diff --git a/src/main/java/net/minecraft/server/NetServerHandler.java b/src/main/java/net/minecraft/server/NetServerHandler.java index e1f3e58273..a5b280d449 100644 --- a/src/main/java/net/minecraft/server/NetServerHandler.java +++ b/src/main/java/net/minecraft/server/NetServerHandler.java @@ -353,17 +353,16 @@ public class NetServerHandler extends NetHandler { d4 = d1 - this.player.locX; double d6 = d2 - this.player.locY; double d7 = d3 - this.player.locZ; - double d8 = Math.min(Math.abs(d4), Math.abs(this.player.motX)); - double d9 = Math.min(Math.abs(d6), Math.abs(this.player.motY)); - double d10 = Math.min(Math.abs(d7), Math.abs(this.player.motZ)); + // CraftBukkit start - min to max + double d8 = Math.max(Math.abs(d4), Math.abs(this.player.motX)); + double d9 = Math.max(Math.abs(d6), Math.abs(this.player.motY)); + double d10 = Math.max(Math.abs(d7), Math.abs(this.player.motZ)); + // CraftBukkit end double d11 = d8 * d8 + d9 * d9 + d10 * d10; if (d11 > 100.0D && this.checkMovement && (!this.minecraftServer.H() || !this.minecraftServer.G().equals(this.player.name))) { // CraftBukkit - Added this.checkMovement condition to solve this check being triggered by teleports logger.warning(this.player.name + " moved too quickly! " + d4 + "," + d6 + "," + d7 + " (" + d8 + ", " + d9 + ", " + d10 + ")"); - // CraftBukkit start - temporarily switch back to kicking - // this.a(this.y, this.z, this.q, this.player.yaw, this.player.pitch); - this.disconnect("You moved too quickly :( (Hacking?)"); - // CraftBukkit end + this.a(this.y, this.z, this.q, this.player.yaw, this.player.pitch); return; } @@ -965,7 +964,7 @@ public class NetServerHandler extends NetHandler { this.player.setSprinting(false); } else if (packet19entityaction.animation == 3) { this.player.a(false, true, true); - this.checkMovement = false; + // this.checkMovement = false; // CraftBukkit - this is handled in teleport } }