Don't teleport entities that are considered dead. Addresses BUKKIT-1331

Teleportation should never be processed on dead entities. If you wish
to teleport an entity, do it on a living entity. If you wish to
teleport a player, set their respawn location in PlayerRespawnEvent.
This commit is contained in:
feildmaster
2012-12-27 19:22:28 -06:00
parent fb0eed177a
commit 7b5a8d0c23
3 changed files with 18 additions and 0 deletions

View File

@@ -190,6 +190,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
}
public boolean teleport(Location location, TeleportCause cause) {
if (entity.vehicle != null || entity.passenger != null || entity.dead) {
return false;
}
entity.world = ((CraftWorld) location.getWorld()).getHandle();
entity.setLocation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
// entity.setLocation() throws no event, and so cannot be cancelled