papermc/CraftBukkit-Patches/0054-Don-t-Special-Case-X-Move-Value.patch

50 lines
2.1 KiB
Diff
Raw Normal View History

2014-03-26 20:34:47 +00:00
From e7f010f312b6dc26465c72c3b7f9dbc876fc199f Mon Sep 17 00:00:00 2001
2013-10-06 06:37:54 +00:00
From: md_5 <md_5@live.com.au>
Date: Sun, 6 Oct 2013 17:36:28 +1100
Subject: [PATCH] Don't Special Case X Move Value
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
2014-03-26 20:34:47 +00:00
index bc4ef27..1ea7e4a 100644
2013-10-06 06:37:54 +00:00
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
2013-12-21 08:13:39 +00:00
@@ -105,6 +105,7 @@ public class PlayerConnection implements PacketPlayInListener {
private float lastPitch = Float.MAX_VALUE;
private float lastYaw = Float.MAX_VALUE;
private boolean justTeleported = false;
+ private boolean hasMoved; // Spigot
2013-12-01 03:40:53 +00:00
// For the PacketPlayOutBlockPlace hack :(
Long lastPacket;
@@ -201,6 +202,18 @@ public class PlayerConnection implements PacketPlayInListener {
2014-03-23 00:06:43 +00:00
// CraftBukkit start - fire PlayerMoveEvent
Player player = this.getPlayer();
+ // Spigot Start
+ if ( !hasMoved )
+ {
+ Location curPos = player.getLocation();
+ lastPosX = curPos.getX();
+ lastPosY = curPos.getY();
+ lastPosZ = curPos.getZ();
+ lastYaw = curPos.getYaw();
+ lastPitch = curPos.getPitch();
+ hasMoved = true;
+ }
+ // Spigot End
Location from = new Location(player.getWorld(), lastPosX, lastPosY, lastPosZ, lastYaw, lastPitch); // Get the Players previous Event location.
Location to = player.getLocation().clone(); // Start off the To location as the Players current location.
@@ -229,7 +242,7 @@ public class PlayerConnection implements PacketPlayInListener {
2013-10-06 06:37:54 +00:00
this.lastPitch = to.getPitch();
// Skip the first time we do this
- if (from.getX() != Double.MAX_VALUE) {
+ if (true) { // Spigot - don't skip any move events
2013-10-06 06:37:54 +00:00
PlayerMoveEvent event = new PlayerMoveEvent(player, from, to);
this.server.getPluginManager().callEvent(event);
--
2014-03-23 00:06:43 +00:00
1.8.5.2.msysgit.0
2013-10-06 06:37:54 +00:00