testserver/CraftBukkit-Patches/0045-Don-t-Special-Case-X-M...

50 lines
2.3 KiB
Diff
Raw Normal View History

2015-04-09 03:45:13 +00:00
From 831b4e3f9b8c22ee9222d7156c6d4ddc22172949 Mon Sep 17 00:00:00 2001
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
2015-04-09 03:45:13 +00:00
index eb4f17b..21da86e 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
2015-02-28 11:36:22 +00:00
@@ -109,6 +109,7 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList
private float lastPitch = Float.MAX_VALUE;
private float lastYaw = Float.MAX_VALUE;
private boolean justTeleported = false;
+ private boolean hasMoved; // Spigot
public CraftPlayer getPlayer() {
return (this.player == null) ? null : (CraftPlayer) this.player.getBukkitEntity();
2015-04-05 15:09:21 +00:00
@@ -223,6 +224,18 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList
2014-11-28 01:17:45 +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.
2015-04-05 15:09:21 +00:00
@@ -251,7 +264,7 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerList
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
2015-04-09 03:45:13 +00:00
Location oldTo = to.clone();
PlayerMoveEvent event = new PlayerMoveEvent(player, from, to);
this.server.getPluginManager().callEvent(event);
--
2014-11-28 01:17:45 +00:00
2.1.0