mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-25 12:05:53 +01:00
dc684c60d1
The new behavior of disconnect to block the current thread until the disconnect succeeded is better than throwing it off to happen at some point
31 lines
1.8 KiB
Diff
31 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 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
|
|
index 0cdb3af5e89b9934257fc26e619b5086711c3486..49f3cc0cf7ee20f754442fc1cbccb66132fbe794 100644
|
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
|
@@ -1350,6 +1350,11 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
|
|
|
this.player.move(MoverType.PLAYER, new Vec3(d6, d7, d8));
|
|
this.player.onGround = packet.isOnGround(); // CraftBukkit - SPIGOT-5810, SPIGOT-5835, SPIGOT-6828: 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 d11 = d7;
|
|
|
|
d6 = d0 - this.player.getX();
|