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:
@@ -41,6 +41,7 @@ import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.entity.SmallFireball;
|
||||
import org.bukkit.entity.Snowball;
|
||||
import org.bukkit.entity.WitherSkull;
|
||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
import org.bukkit.inventory.EntityEquipment;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
@@ -346,4 +347,13 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
public boolean getCanPickupItems() {
|
||||
return getHandle().canPickUpLoot;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean teleport(Location location, PlayerTeleportEvent.TeleportCause cause) {
|
||||
if (getHealth() == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return super.teleport(location, cause);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user