aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0349-Prevent-teleporting-dead-entities.patch
blob: ee1f3e1a971b87fd0d6e743d075d40dc7ed5b38e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Tue, 3 Mar 2020 05:26:40 +0000
Subject: [PATCH] Prevent teleporting dead entities


diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 1b82e733c107540618cb1f69511ea9e1a4a13fc8..9286012c7a07e1a621035b0563cb06a3421ea945 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1571,6 +1571,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
     }
 
     public void internalTeleport(PositionMoveRotation positionmoverotation, Set<Relative> set) {
+        // Paper start - Prevent teleporting dead entities
+        if (player.isRemoved()) {
+            LOGGER.info("Attempt to teleport removed player {} restricted", player.getScoreboardName());
+            if (server.isDebugging()) io.papermc.paper.util.TraceUtil.dumpTraceForThread("Attempt to teleport removed player");
+            return;
+        }
+        // Paper end - Prevent teleporting dead entities
         if (Float.isNaN(positionmoverotation.yRot())) {
             positionmoverotation = new PositionMoveRotation(positionmoverotation.position(), positionmoverotation.deltaMovement(), 0, positionmoverotation.xRot());
         }