0
0
mirror of https://hub.spigotmc.org/stash/scm/spigot/spigot.git synced 2024-11-21 20:56:14 +00:00
spigot/CraftBukkit-Patches/0020-Prevent-Ghost-Players-Caused-by-Plugins.patch
2024-10-23 02:15:00 +11:00

43 lines
1.9 KiB
Diff

From d85e845bd6e43447345af8d39ef750a2735ecf3b Mon Sep 17 00:00:00 2001
From: Alex Ciuba <alexciuba@gmail.com>
Date: Tue, 11 Jun 2013 15:23:03 -0400
Subject: [PATCH] Prevent Ghost Players Caused by Plugins
Check if the player is still connected after firing event. Fixes BUKKIT-4327
diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java
index 7c86389a88..4935614a7a 100644
--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java
@@ -1379,6 +1379,11 @@ public class EntityPlayer extends EntityHuman {
PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn, isAnchorSpawn, reason);
this.level().getCraftServer().getPluginManager().callEvent(respawnEvent);
+ // Spigot Start
+ if (this.connection.isDisconnected()) {
+ return null;
+ }
+ // Spigot End
location = respawnEvent.getRespawnLocation();
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 6ec24ecfce..ea2864bfb7 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -672,6 +672,11 @@ public abstract class PlayerList {
} else {
teleporttransition = new TeleportTransition(((CraftWorld) location.getWorld()).getHandle(), CraftLocation.toVec3D(location), Vec3D.ZERO, location.getYaw(), location.getPitch(), TeleportTransition.DO_NOTHING);
}
+ // Spigot Start
+ if (teleporttransition == null) {
+ return entityplayer;
+ }
+ // Spigot End
WorldServer worldserver = teleporttransition.newLevel();
entityplayer1.spawnIn(worldserver);
entityplayer1.unsetRemoved();
--
2.47.0