Fix "moved too quickly" detection.

This commit is contained in:
Travis Watkins 2012-08-05 23:45:38 -05:00
parent e1a4273957
commit 164c066453
3 changed files with 9 additions and 16 deletions

View file

@ -950,14 +950,6 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
} }
public void a(boolean flag, boolean flag1, boolean flag2) { 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.a(0.6F, 1.8F);
this.d_(); this.d_();
ChunkCoordinates chunkcoordinates = this.bT; ChunkCoordinates chunkcoordinates = this.bT;

View file

@ -431,6 +431,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
public void a(boolean flag, boolean flag1, boolean flag2) { 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()) { if (this.isSleeping()) {
this.q().getTracker().sendPacketToEntity(this, new Packet18ArmAnimation(this, 3)); this.q().getTracker().sendPacketToEntity(this, new Packet18ArmAnimation(this, 3));
} }

View file

@ -353,17 +353,16 @@ public class NetServerHandler extends NetHandler {
d4 = d1 - this.player.locX; d4 = d1 - this.player.locX;
double d6 = d2 - this.player.locY; double d6 = d2 - this.player.locY;
double d7 = d3 - this.player.locZ; double d7 = d3 - this.player.locZ;
double d8 = Math.min(Math.abs(d4), Math.abs(this.player.motX)); // CraftBukkit start - min to max
double d9 = Math.min(Math.abs(d6), Math.abs(this.player.motY)); double d8 = Math.max(Math.abs(d4), Math.abs(this.player.motX));
double d10 = Math.min(Math.abs(d7), Math.abs(this.player.motZ)); 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; 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 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 + ")"); 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.a(this.y, this.z, this.q, this.player.yaw, this.player.pitch);
this.disconnect("You moved too quickly :( (Hacking?)");
// CraftBukkit end
return; return;
} }
@ -965,7 +964,7 @@ public class NetServerHandler extends NetHandler {
this.player.setSprinting(false); this.player.setSprinting(false);
} else if (packet19entityaction.animation == 3) { } else if (packet19entityaction.animation == 3) {
this.player.a(false, true, true); this.player.a(false, true, true);
this.checkMovement = false; // this.checkMovement = false; // CraftBukkit - this is handled in teleport
} }
} }