diff options
author | Erik Broes <erikbroes@grum.nl> | 2011-03-24 00:52:10 +0100 |
---|---|---|
committer | Erik Broes <erikbroes@grum.nl> | 2011-03-24 00:52:10 +0100 |
commit | 748b71b3ccb242c762cb937e6943fe7ea3bdb917 (patch) | |
tree | f1a47f1459de45fabbd52bfda67220ce7cf6d660 /src | |
parent | 31293488663c6cd73a566f96165f817072a37571 (diff) | |
download | craftbukkit-748b71b3ccb242c762cb937e6943fe7ea3bdb917.tar craftbukkit-748b71b3ccb242c762cb937e6943fe7ea3bdb917.tar.gz craftbukkit-748b71b3ccb242c762cb937e6943fe7ea3bdb917.tar.lz craftbukkit-748b71b3ccb242c762cb937e6943fe7ea3bdb917.tar.xz craftbukkit-748b71b3ccb242c762cb937e6943fe7ea3bdb917.zip |
Fix accidental Double.MAX_VALUE coordinates in initial PlayerMoveEvent
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/net/minecraft/server/NetServerHandler.java | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/main/java/net/minecraft/server/NetServerHandler.java b/src/main/java/net/minecraft/server/NetServerHandler.java index 1f4bff93..51d20f43 100644 --- a/src/main/java/net/minecraft/server/NetServerHandler.java +++ b/src/main/java/net/minecraft/server/NetServerHandler.java @@ -123,17 +123,20 @@ public class NetServerHandler extends NetHandler implements ICommandListener { float deltaAngle = Math.abs(this.lastYaw - this.e.yaw) + Math.abs(this.lastPitch - this.e.pitch); if (delta > 1f/256 || deltaAngle > 10f) { - PlayerMoveEvent event = new PlayerMoveEvent(Type.PLAYER_MOVE, player, from, to); - server.getPluginManager().callEvent(event); - - from = event.getFrom(); - to = event.isCancelled() ? from : event.getTo(); + // Skip the first time we do this + if (lastPosX != Double.MAX_VALUE) { + PlayerMoveEvent event = new PlayerMoveEvent(Type.PLAYER_MOVE, player, from, to); + server.getPluginManager().callEvent(event); + + from = event.getFrom(); + to = event.isCancelled() ? from : event.getTo(); - this.e.locX = to.getX(); - this.e.locY = to.getY(); - this.e.locZ = to.getZ(); - this.e.yaw = to.getYaw(); - this.e.pitch = to.getPitch(); + this.e.locX = to.getX(); + this.e.locY = to.getY(); + this.e.locZ = to.getZ(); + this.e.yaw = to.getYaw(); + this.e.pitch = to.getPitch(); + } this.lastPosX = this.e.locX; this.lastPosY = this.e.locY; |