From ed9fc11fe3fdea0d3b28ffb33bc2a7da238763fc Mon Sep 17 00:00:00 2001 From: Aikar Date: Sun, 3 May 2020 14:28:45 -0400 Subject: [PATCH] Sync position on teleportation We've seen many a cases where the "last good" x/y/z is desynced from the x/y/z that is checked for moving too fast. Theory is that when you have multiple movement packets queued up, and the player is teleported after the first then the 2nd and 3rd come in, it is triggering a massive movement velocity. This will ensure that the servers position is synchronized anytime player is te Fixes #3258 --- .../0498-Sync-position-on-teleportation.patch | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 Spigot-Server-Patches/0498-Sync-position-on-teleportation.patch diff --git a/Spigot-Server-Patches/0498-Sync-position-on-teleportation.patch b/Spigot-Server-Patches/0498-Sync-position-on-teleportation.patch new file mode 100644 index 0000000000..6d9eb5b8ae --- /dev/null +++ b/Spigot-Server-Patches/0498-Sync-position-on-teleportation.patch @@ -0,0 +1,37 @@ +From 1e7d68cf958496b9e67872eeb5cc01364bd15339 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Sun, 3 May 2020 14:25:55 -0400 +Subject: [PATCH] Sync position on teleportation + +We've seen many a cases where the "last good" x/y/z is desynced from +the x/y/z that is checked for moving too fast. + +Theory is that when you have multiple movement packets queued up, +and the player is teleported after the first then the 2nd and 3rd come in, +it is triggering a massive movement velocity. + +This will ensure that the servers position is synchronized anytime player is teleported. + +diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +index 02bda8bee4..a188d9f3b6 100644 +--- a/src/main/java/net/minecraft/server/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/PlayerConnection.java +@@ -500,6 +500,7 @@ public class PlayerConnection implements PacketListenerPlayIn { + this.o = this.teleportPos.x; + this.p = this.teleportPos.y; + this.q = this.teleportPos.z; ++ this.syncPosition(); // Paper + if (this.player.H()) { + this.player.I(); + } +@@ -1271,6 +1272,7 @@ public class PlayerConnection implements PacketListenerPlayIn { + + this.A = this.e; + this.player.setLocation(d0, d1, d2, f, f1); ++ this.syncPosition(); // Paper + this.player.playerConnection.sendPacket(new PacketPlayOutPosition(d0 - d3, d1 - d4, d2 - d5, f - f2, f1 - f3, set, this.teleportAwait)); + } + +-- +2.26.2 +