spigot/CraftBukkit-Patches/0034-Don-t-Special-Case-X-Move-Value.patch

57 lines
2.8 KiB
Diff
Raw Normal View History

2018-11-14 14:20:34 +11:00
From 9a5ca67b7cc32e9ebb1905bddb32b31acfc474d3 Mon Sep 17 00:00:00 2001
2014-04-12 14:18:37 +10: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
2018-11-10 20:46:28 +11:00
index 236bdaa01..67c00f690 100644
2014-04-12 14:18:37 +10:00
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
2018-08-26 12:00:00 +10:00
@@ -128,6 +128,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
2014-04-12 14:18:37 +10:00
private float lastPitch = Float.MAX_VALUE;
private float lastYaw = Float.MAX_VALUE;
private boolean justTeleported = false;
+ private boolean hasMoved; // Spigot
2014-11-28 23:22:31 +00:00
public CraftPlayer getPlayer() {
return (this.player == null) ? null : (CraftPlayer) this.player.getBukkitEntity();
2018-10-27 17:44:13 +11:00
@@ -358,6 +359,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
2018-09-26 17:19:21 +10:00
flag1 = true;
PlayerConnection.LOGGER.warn("{} moved wrongly!", entity.getDisplayName().getString());
}
+ Location curPos = this.getPlayer().getLocation(); // Spigot
entity.setLocation(d3, d4, d5, f, f1);
2018-11-10 20:46:28 +11:00
player.setLocation(d3, d4, d5, this.player.yaw, this.player.pitch); // CraftBukkit
2018-10-27 17:44:13 +11:00
@@ -372,6 +374,17 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
2016-03-01 08:33:06 +11:00
2015-05-22 14:52:56 +01:00
// CraftBukkit start - fire PlayerMoveEvent
Player player = this.getPlayer();
+ // Spigot Start
+ if ( !hasMoved )
+ {
+ 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.
2014-04-12 14:18:37 +10:00
2018-10-27 17:44:13 +11:00
@@ -397,7 +410,7 @@ public class PlayerConnection implements PacketListenerPlayIn, ITickable {
2015-05-22 14:52:56 +01:00
this.lastPitch = to.getPitch();
2014-04-12 14:18:37 +10:00
2015-05-22 14:52:56 +01:00
// Skip the first time we do this
- if (from.getX() != Double.MAX_VALUE) {
+ if (true) { // Spigot - don't skip any move events
Location oldTo = to.clone();
PlayerMoveEvent event = new PlayerMoveEvent(player, from, to);
this.server.getPluginManager().callEvent(event);
2014-04-12 14:18:37 +10:00
--
2018-11-14 14:20:34 +11:00
2.19.1
2014-04-12 14:18:37 +10:00