From 0048b22e4411024d614f1c94d4c38b3919954d99 Mon Sep 17 00:00:00 2001 From: EvilSeph Date: Tue, 19 Apr 2011 01:04:13 -0400 Subject: Fixed another issue involving invalid player positions or movement. --- .../net/minecraft/server/NetServerHandler.java | 45 ++++++++++++++-------- 1 file changed, 28 insertions(+), 17 deletions(-) (limited to 'src/main/java/net/minecraft/server') diff --git a/src/main/java/net/minecraft/server/NetServerHandler.java b/src/main/java/net/minecraft/server/NetServerHandler.java index 0951937b..449df13d 100644 --- a/src/main/java/net/minecraft/server/NetServerHandler.java +++ b/src/main/java/net/minecraft/server/NetServerHandler.java @@ -252,38 +252,49 @@ public class NetServerHandler extends NetHandler implements ICommandListener { } } - if (packet10flying.i) { - f2 = packet10flying.e; - f3 = packet10flying.f; - } - - this.e.a(true); - this.e.bl = 0.0F; - this.e.b(this.i, this.j, this.k, f2, f3); + // Craftbukkit start - better fix for invalid position issues; should be fixed in 1.5 d4 = d1 - this.e.locX; double d6 = d2 - this.e.locY; double d7 = d3 - this.e.locZ; float f4 = 0.0625F; - // CraftBukkit - boolean flag = this.e.world.a(this.e, this.e.boundingBox.b().e((double) f4, (double) f4, (double) f4)).size() == 0; + + if (d6 > -0.5D || d6 < 0.5D) { + d6 = 0.0D; + } + + d7 = d3 - this.e.locZ; + double d8 = d4 * d4 + d6 * d6 + d7 * d7; + boolean flag1 = false; + + if (d8 > 6.25D && !this.e.F()) { + flag1 = true; + a.warning(this.e.name + " was caught moving faster than the maximum allowed speed. Possible malicious activity?"); + this.a(this.i, this.j, this.k, f2, f3); + return; + } this.e.c(d4, d6, d7); d4 = d1 - this.e.locX; d6 = d2 - this.e.locY; + if (d6 > -0.5D || d6 < 0.5D) { d6 = 0.0D; } d7 = d3 - this.e.locZ; - double d8 = d4 * d4 + d6 * d6 + d7 * d7; - boolean flag1 = false; - if (d8 > 0.0625D && !this.e.F()) { - flag1 = true; - a.warning(this.e.name + " moved wrongly!"); - System.out.println("Got position " + d1 + ", " + d2 + ", " + d3); - System.out.println("Expected " + this.e.locX + ", " + this.e.locY + ", " + this.e.locZ); + if (packet10flying.i) { + f2 = packet10flying.e; + f3 = packet10flying.f; } + // Craftbukkit end + + this.e.a(true); + this.e.bl = 0.0F; + this.e.b(this.i, this.j, this.k, f2, f3); + + // CraftBukkit + boolean flag = this.e.world.a(this.e, this.e.boundingBox.b().e((double) f4, (double) f4, (double) f4)).size() == 0; this.e.b(d1, d2, d3, f2, f3); // CraftBukkit -- cgit v1.2.3