aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches/0410-Block-Entity-remove-from-being-called-on-Players.patch
diff options
context:
space:
mode:
Diffstat (limited to 'Spigot-Server-Patches/0410-Block-Entity-remove-from-being-called-on-Players.patch')
-rw-r--r--Spigot-Server-Patches/0410-Block-Entity-remove-from-being-called-on-Players.patch36
1 files changed, 36 insertions, 0 deletions
diff --git a/Spigot-Server-Patches/0410-Block-Entity-remove-from-being-called-on-Players.patch b/Spigot-Server-Patches/0410-Block-Entity-remove-from-being-called-on-Players.patch
new file mode 100644
index 0000000000..681f6c4b2e
--- /dev/null
+++ b/Spigot-Server-Patches/0410-Block-Entity-remove-from-being-called-on-Players.patch
@@ -0,0 +1,36 @@
+From 355b9a0bb1d1af72cb61b3f8850c5b387dcf7b89 Mon Sep 17 00:00:00 2001
+From: Zach Brown <[email protected]>
+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 a03796cd5e..eb5971ac19 100644
+--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+@@ -1942,6 +1942,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
+ public void resetCooldown() {
+ getHandle().resetCooldown();
+ }
++
++ @Override
++ public void remove() {
++ if (this.getHandle().getClass().equals(EntityPlayer.class)) { // special case for NMS plugins inheriting
++ throw new UnsupportedOperationException("Calling Entity#remove on players produces undefined (bad) behavior");
++ } else {
++ super.remove();
++ }
++ }
+ //Paper end
+
+ // Spigot start
+--
+2.21.0
+