forked from LogBlock/LogBlock
@@ -160,12 +160,16 @@ public class AdvancedEntityLogging extends LoggingListener {
|
|||||||
public void onEntityDeath(EntityDeathEvent event) {
|
public void onEntityDeath(EntityDeathEvent event) {
|
||||||
LivingEntity entity = event.getEntity();
|
LivingEntity entity = event.getEntity();
|
||||||
if (Config.isLogging(entity.getWorld(), EntityLogging.DESTROY, entity)) {
|
if (Config.isLogging(entity.getWorld(), EntityLogging.DESTROY, entity)) {
|
||||||
Actor actor;
|
Actor actor = null;
|
||||||
EntityDamageEvent lastDamage = entity.getLastDamageCause();
|
EntityDamageEvent lastDamage = entity.getLastDamageCause();
|
||||||
if (lastDamage instanceof EntityDamageByEntityEvent) {
|
if (lastDamage instanceof EntityDamageByEntityEvent) {
|
||||||
actor = Actor.actorFromEntity(((EntityDamageByEntityEvent) lastDamage).getDamager());
|
Entity damager = ((EntityDamageByEntityEvent) lastDamage).getDamager();
|
||||||
} else {
|
if (damager != null) {
|
||||||
actor = new Actor(lastDamage.getCause().toString());
|
actor = Actor.actorFromEntity(damager);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (actor == null) {
|
||||||
|
actor = new Actor(lastDamage == null ? "UNKNOWN" : lastDamage.getCause().toString());
|
||||||
}
|
}
|
||||||
queueEntitySpawnOrKill(entity, actor, EntityChange.EntityChangeType.KILL);
|
queueEntitySpawnOrKill(entity, actor, EntityChange.EntityChangeType.KILL);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user