mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-18 20:53:09 +01:00
da9d110d5b
This patch does not appear to be doing anything useful, and may hide errors. Currently, the save logic does not run through this path either so it did not do anything. Additionally, properly implement support for handling RegionFileSizeException in Moonrise.
26 lines
1.3 KiB
Diff
26 lines
1.3 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Zach Brown <zach@zachbr.io>
|
|
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 b118f3214d4ab039e09da04019117a0085e47dcc..b3b13f1baea0b170fd4f1546689aad40f53d3c27 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
@@ -229,8 +229,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
|