Paper/Spigot-Server-Patches/0501-Prevent-position-desync-in-playerconnection-causing-.patch
Daniel Ennis e792da723a
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#4728)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
30885166 Update to Minecraft 1.16.4

CraftBukkit Changes:
3af81c71 Update to Minecraft 1.16.4

Spigot Changes:
f011ca24 Update to Minecraft 1.16.4

Co-authored-by: Mariell Hoversholm <proximyst@proximyst.com>
2020-11-02 20:22:15 -06:00

32 lines
1.8 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
Date: Fri, 12 Jun 2020 16:51:39 -0700
Subject: [PATCH] Prevent position desync in playerconnection causing tp
exploit
Caused the server to revert to the player's overworld coordinates
after teleporting into the end.
Sidenote: The underlying issue is that the move call can teleport
entities and do other things like kill the entity. In the future,
to fix all exploits derieved from this usually unexpected
behaviour, we need to move all of this dangerous logic outside
of the move call and into an appropriate place in the tick method.
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 8c3a5b11d32d6ccf4f76387db629943935234973..1a3aba5754bcbdd0400d3a090e5a754fcecb4406 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1166,6 +1166,11 @@ public class PlayerConnection implements PacketListenerPlayIn {
this.player.move(EnumMoveType.PLAYER, new Vec3D(d7, d8, d9));
this.player.setOnGround(packetplayinflying.b()); // CraftBukkit - SPIGOT-5810, SPIGOT-5835: reset by this.player.move
+ // Paper start - prevent position desync
+ if (this.teleportPos != null) {
+ return; // ... thanks Mojang for letting move calls teleport across dimensions.
+ }
+ // Paper end - prevent position desync
double d12 = d8;
d7 = d4 - this.player.locX();