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.
Dieser Commit ist enthalten in:
Ursprung
fb0eed177a
Commit
7b5a8d0c23
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -348,6 +348,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
public boolean teleport(Location location, PlayerTeleportEvent.TeleportCause cause) {
|
||||
EntityPlayer entity = getHandle();
|
||||
|
||||
if (getHealth() == 0 || entity.dead) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (entity.playerConnection == null || entity.playerConnection.disconnected) {
|
||||
return false;
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren