mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-01 17:01:56 +01:00
Only enforce CraftPlayer#remove exception on instances of EntityPlayer
Should be more friendly to plugins that dabble in inheriting NMS entities.
This commit is contained in:
parent
d08d908d6d
commit
df424d7a65
1 changed files with 6 additions and 2 deletions
|
@ -12,7 +12,7 @@ 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.
|
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
|
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
|
index 36a38713..fbe34290 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||||
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||||
|
@ -22,7 +22,11 @@ index 36a38713..7b7dc7f2 100644
|
||||||
+
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public void remove() {
|
+ public void remove() {
|
||||||
+ throw new UnsupportedOperationException("Calling Entity#remove on players produces undefined (bad) behavior");
|
+ 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
|
//Paper end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue