Cross World Entity Teleportation

Use Entity.teleportTo for cross-world teleportation in CraftEntity.

By: Andrew Krieger <Slizyboy@hotmail.com>
This commit is contained in:
CraftBukkit/Spigot 2019-01-05 16:21:07 +11:00
parent bda697612e
commit b05a252b02

View file

@ -306,7 +306,12 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
// If this entity is riding another entity, we must dismount before teleporting.
entity.stopRiding();
entity.world = ((CraftWorld) location.getWorld()).getHandle();
// Let the server handle cross world teleports
if (!location.getWorld().equals(getWorld())) {
entity.teleportTo(location, cause == TeleportCause.NETHER_PORTAL);
return true;
}
// entity.setLocation() throws no event, and so cannot be cancelled
entity.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
// SPIGOT-619: Force sync head rotation also