diff options
author | Jason Penilla <[email protected]> | 2024-04-27 13:27:01 -0700 |
---|---|---|
committer | Jason Penilla <[email protected]> | 2024-04-27 13:27:01 -0700 |
commit | e2552eea2481871c9d8445a3c5653a2329112648 (patch) | |
tree | 727c90f395576b66200f8d9e59f38859f3850562 /patches/server/0280-Dont-block-Player-remove-if-the-handle-is-a-custom-p.patch | |
parent | 0b1b1fe067444c5e879313e017da0ffd5d6b826d (diff) | |
download | Paper-e2552eea2481871c9d8445a3c5653a2329112648.tar.gz Paper-e2552eea2481871c9d8445a3c5653a2329112648.zip |
Start cleaning up plugin remapping patches
Diffstat (limited to 'patches/server/0280-Dont-block-Player-remove-if-the-handle-is-a-custom-p.patch')
-rw-r--r-- | patches/server/0280-Dont-block-Player-remove-if-the-handle-is-a-custom-p.patch | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/patches/server/0280-Dont-block-Player-remove-if-the-handle-is-a-custom-p.patch b/patches/server/0280-Dont-block-Player-remove-if-the-handle-is-a-custom-p.patch new file mode 100644 index 0000000000..7ff0d9c37b --- /dev/null +++ b/patches/server/0280-Dont-block-Player-remove-if-the-handle-is-a-custom-p.patch @@ -0,0 +1,26 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Zach Brown <[email protected]> +Date: Mon, 4 Feb 2019 23:33:24 -0500 +Subject: [PATCH] Dont block Player#remove if the handle is a custom player + +Upstream throws UOE if you try to call remove on a Player. +We just add a check to ensure that the CraftPlayer's handle +is a ServerPlayer + +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +index 11c429225f3242a0bb4bcef8c47fad1cbb5c9a43..4c12ad37d304460ca79033282c52cf851537d1f9 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +@@ -222,8 +222,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player { + + @Override + public void remove() { ++ if (this.getHandle().getClass().equals(ServerPlayer.class)) { // special case for NMS plugins inheriting + // Will lead to an inconsistent player state if we remove the player as any other entity. + throw new UnsupportedOperationException(String.format("Cannot remove player %s, use Player#kickPlayer(String) instead.", this.getName())); ++ } else { ++ super.remove(); ++ } + } + + @Override |