fix damage type actors

This commit is contained in:
Brokkonaut
2025-02-26 05:43:29 +01:00
parent 0a685bca27
commit c14b17a522
2 changed files with 8 additions and 2 deletions

View File

@ -2,6 +2,7 @@ package de.diddiz.LogBlock.listeners;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.block.BlockFace;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.ArmorStand;
@ -201,7 +202,8 @@ public class AdvancedEntityLogging extends LoggingListener {
actor = Actor.actorFromEntity(entity.getKiller());
}
if (actor == null) {
actor = new Actor(event.getDamageSource().getDamageType().toString());
NamespacedKey key = event.getDamageSource().getDamageType().getKey();
actor = new Actor(key == null ? "unknown" : key.getKey().toUpperCase());
}
queueEntitySpawnOrKill(entity, actor, EntityChange.EntityChangeType.KILL);
}

View File

@ -4,6 +4,7 @@ import de.diddiz.LogBlock.Actor;
import de.diddiz.LogBlock.LogBlock;
import de.diddiz.LogBlock.Logging;
import de.diddiz.LogBlock.config.Config.*;
import org.bukkit.NamespacedKey;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Monster;
@ -38,7 +39,10 @@ public class KillLogging extends LoggingListener {
} else if (logKillsLevel == LogKillsLevel.MONSTERS && !((victim instanceof Player || victim instanceof Monster))) {
return;
}
consumer.queueKill(new Actor(deathEvent.getDamageSource().getDamageType().toString()), victim);
NamespacedKey key = deathEvent.getDamageSource().getDamageType().getKey();
Actor actor = new Actor(key == null ? "unknown" : key.getKey().toUpperCase());
consumer.queueKill(actor, victim);
}
}
}