mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-31 00:20:44 +01:00
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
This commit is contained in:
parent
2c43d196e4
commit
4c350ecbb5
1 changed files with 4 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue