Block Entity#remove from being called on Players

This doesn't result in the same behavior as other entities and causes
several problems. Anyone ever complain about the "Cannot send chat
message" thing? That's one of the issues this causes, among others.

If a plugin developer can come up with a valid reason to call this on a
Player we will look at limiting the scope of this change. It appears to
be unintentional in the few cases we've seen so far.
This commit is contained in:
Zach Brown 2019-02-04 23:43:28 -05:00
parent 5ae3895105
commit 28cf2696d4
No known key found for this signature in database
GPG key ID: CC9DA35FC5450B76
2 changed files with 35 additions and 3 deletions

View file

@ -1,4 +1,4 @@
From e80a8c46c6462f6ab527d9ab29be39f9b904c84e Mon Sep 17 00:00:00 2001
From b29be1d2fea8597e02b6dfc3bd4ebe0096c7bb30 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 2 Jan 2017 16:32:56 -0500
Subject: [PATCH] ShulkerBox Dupe Prevention
@ -7,7 +7,7 @@ This ensures that Shulker Boxes can never drop their contents twice, and
that the inventory is cleared incase it some how also got saved to the world.
diff --git a/src/main/java/net/minecraft/server/BlockShulkerBox.java b/src/main/java/net/minecraft/server/BlockShulkerBox.java
index de8fc8bba..978c9954d 100644
index ab0ece55..997ed795 100644
--- a/src/main/java/net/minecraft/server/BlockShulkerBox.java
+++ b/src/main/java/net/minecraft/server/BlockShulkerBox.java
@@ -100,6 +100,7 @@ public class BlockShulkerBox extends BlockTileEntity {
@ -19,5 +19,5 @@ index de8fc8bba..978c9954d 100644
}
world.updateAdjacentComparators(blockposition, iblockdata.getBlock());
--
2.20.0
2.20.1.windows.1

View file

@ -0,0 +1,32 @@
From 77bf3954e56da679c67b1fab72772d8824ffb401 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach@zachbr.io>
Date: Mon, 4 Feb 2019 23:33:24 -0500
Subject: [PATCH] Block Entity#remove from being called on Players
This doesn't result in the same behavior as other entities and causes
several problems. Anyone ever complain about the "Cannot send chat
message" thing? That's one of the issues this causes, among others.
If a plugin developer can come up with a valid reason to call this on a
Player we will look at limiting the scope of this change. It appears to
be unintentional in the few cases we've seen so far.
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 36a38713..7b7dc7f2 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1937,6 +1937,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
public void resetCooldown() {
getHandle().resetCooldown();
}
+
+ @Override
+ public void remove() {
+ throw new UnsupportedOperationException("Calling Entity#remove on players produces undefined (bad) behavior");
+ }
//Paper end
// Spigot start
--
2.20.1.windows.1