mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 19:15:32 +01:00
No teleporting people back into the server. Fixes BUKKIT-2298
Stale player references will add a player back into the world when teleporting them, causing a cascade of issues relating to ghost entities and servers failing to stop.
This commit is contained in:
parent
d23c97429f
commit
d039986be7
@ -345,7 +345,8 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean teleport(Location location, PlayerTeleportEvent.TeleportCause cause) {
|
public boolean teleport(Location location, PlayerTeleportEvent.TeleportCause cause) {
|
||||||
if (getHandle().netServerHandler == null) return false;
|
EntityPlayer entity = getHandle();
|
||||||
|
if (entity.netServerHandler == null || entity.netServerHandler.disconnected) return false;
|
||||||
|
|
||||||
// From = Players current Location
|
// From = Players current Location
|
||||||
Location from = this.getLocation();
|
Location from = this.getLocation();
|
||||||
@ -365,8 +366,6 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|||||||
// Grab the To and From World Handles.
|
// Grab the To and From World Handles.
|
||||||
WorldServer fromWorld = ((CraftWorld) from.getWorld()).getHandle();
|
WorldServer fromWorld = ((CraftWorld) from.getWorld()).getHandle();
|
||||||
WorldServer toWorld = ((CraftWorld) to.getWorld()).getHandle();
|
WorldServer toWorld = ((CraftWorld) to.getWorld()).getHandle();
|
||||||
// Grab the EntityPlayer
|
|
||||||
EntityPlayer entity = getHandle();
|
|
||||||
|
|
||||||
// Check if the fromWorld and toWorld are the same.
|
// Check if the fromWorld and toWorld are the same.
|
||||||
if (fromWorld == toWorld) {
|
if (fromWorld == toWorld) {
|
||||||
|
Loading…
Reference in New Issue
Block a user