2021-06-11 14:02:28 +02:00
|
|
|
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/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
2021-06-16 02:50:38 +02:00
|
|
|
index 7e4e2174665eaf0277c0b547fe6c9e05fdf59c81..3493fb7f526cb713340475734f176aa52ade2d12 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
2021-06-14 10:37:14 +02:00
|
|
|
@@ -1345,6 +1345,11 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
2021-06-11 14:02:28 +02:00
|
|
|
|
|
|
|
this.player.move(MoverType.PLAYER, new Vec3(d7, d8, d9));
|
|
|
|
this.player.setOnGround(packet.isOnGround()); // CraftBukkit - SPIGOT-5810, SPIGOT-5835: reset by this.player.move
|
|
|
|
+ // Paper start - prevent position desync
|
|
|
|
+ if (this.awaitingPositionFromClient != null) {
|
|
|
|
+ return; // ... thanks Mojang for letting move calls teleport across dimensions.
|
|
|
|
+ }
|
|
|
|
+ // Paper end - prevent position desync
|
|
|
|
double d12 = d8;
|
|
|
|
|
2021-06-14 10:37:14 +02:00
|
|
|
d7 = d0 - this.player.getX();
|