|
|
@ -63,16 +63,13 @@ public class Messenger { |
|
|
|
|
|
|
|
|
|
|
|
private String damageMessage(Player player, double damage, Entity damagingEntity){ |
|
|
|
private String damageMessage(Player player, double damage, Entity damagingEntity){ |
|
|
|
String damagingEntityName = damagingEntity.getName(); |
|
|
|
String damagingEntityName = damagingEntity.getName(); |
|
|
|
if (damagingEntity instanceof Projectile){ |
|
|
|
if (damagingEntity instanceof Projectile projectile){ |
|
|
|
Projectile projectile = (Projectile) damagingEntity; |
|
|
|
|
|
|
|
ProjectileSource source = projectile.getShooter(); |
|
|
|
ProjectileSource source = projectile.getShooter(); |
|
|
|
if (source != null){ |
|
|
|
if (source != null){ |
|
|
|
if (source instanceof Entity){ |
|
|
|
if (source instanceof Entity shooterEntity){ |
|
|
|
Entity shooterEntity = (Entity) source; |
|
|
|
|
|
|
|
damagingEntityName = shooterEntity.getName(); |
|
|
|
damagingEntityName = shooterEntity.getName(); |
|
|
|
} |
|
|
|
} |
|
|
|
if (source instanceof BlockProjectileSource){ |
|
|
|
if (source instanceof BlockProjectileSource shooterBlock){ |
|
|
|
BlockProjectileSource shooterBlock = (BlockProjectileSource) source; |
|
|
|
|
|
|
|
return damageMessage(player, damage, shooterBlock.getBlock()); |
|
|
|
return damageMessage(player, damage, shooterBlock.getBlock()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|