mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 11:06:29 +01:00
32 lines
1.6 KiB
Diff
32 lines
1.6 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 66dd1b3bfeebab8dd0f4e823dd0daea903343413..0cb2efb10694c81786a95301f3da86121ea27b17 100644
|
|
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
|
@@ -1097,6 +1097,11 @@ public class PlayerConnection implements PacketListenerPlayIn {
|
|
}
|
|
|
|
this.player.move(EnumMoveType.PLAYER, new Vec3D(d7, d8, d9));
|
|
+ // 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();
|