Prevent teleporting dead entities (#2803)

This commit is contained in:
Shane Freeder 2020-03-03 05:28:35 +00:00
parent 5ce1dd48e1
commit ccf1d5908f
No known key found for this signature in database
GPG key ID: A3F61EA5A085289C
2 changed files with 29 additions and 4 deletions

View file

@ -1,4 +1,4 @@
From 1735e9e48b344eb98d739f46cda33177ba37107e Mon Sep 17 00:00:00 2001
From eeb73f0f817591d7385cc0db9bcc91e7b800f1f9 Mon Sep 17 00:00:00 2001
From: Trigary <trigary0@gmail.com>
Date: Sun, 1 Mar 2020 22:43:34 +0100
Subject: [PATCH] add hand to BlockMultiPlaceEvent
@ -11,7 +11,7 @@ index fe2ec79dd..8460aa4f5 100644
@@ -18,9 +18,17 @@ import org.jetbrains.annotations.NotNull;
public class BlockMultiPlaceEvent extends BlockPlaceEvent {
private final List<BlockState> states;
+ @Deprecated // Paper
public BlockMultiPlaceEvent(@NotNull List<BlockState> states, @NotNull Block clicked, @NotNull ItemStack itemInHand, @NotNull Player thePlayer, boolean canBuild) {
- super(states.get(0).getBlock(), states.get(0), clicked, itemInHand, thePlayer, canBuild);
@ -25,7 +25,8 @@ index fe2ec79dd..8460aa4f5 100644
this.states = ImmutableList.copyOf(states);
+ //Paper end
}
/**
--
--
2.25.0

View file

@ -0,0 +1,24 @@
From f884e53d1700a3a0574ddb50a6400e50706d752e 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/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 108377d76..c6bd62392 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1209,6 +1209,10 @@ public class PlayerConnection implements PacketListenerPlayIn {
}
private void internalTeleport(double d0, double d1, double d2, float f, float f1, Set<PacketPlayOutPosition.EnumPlayerTeleportFlags> set) {
+ if (player.dead) {
+ LOGGER.info("Attempt to teleport dead player %s restricted", player.getName());
+ return;
+ }
// CraftBukkit start
if (Float.isNaN(f)) {
f = 0;
--
2.25.0