Fixed zombies killed by wither roses not being logged when skip-generic-data is enabled (fixes #309)

This commit is contained in:
Intelli 2024-01-04 20:56:21 -07:00
parent c91f460e42
commit 15e8cd5b88

View File

@ -1,6 +1,7 @@
package net.coreprotect.listener.entity; package net.coreprotect.listener.entity;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Map; import java.util.Map;
@ -121,8 +122,11 @@ public final class EntityDeathListener extends Queue implements Listener {
e = isCommand ? "#command" : ""; e = isCommand ? "#command" : "";
} }
List<DamageCause> validDamageCauses = Arrays.asList(DamageCause.KILL, DamageCause.POISON, DamageCause.THORNS, DamageCause.MAGIC, DamageCause.WITHER);
boolean skip = true; boolean skip = true;
if (!Config.getConfig(entity.getWorld()).SKIP_GENERIC_DATA || (!(entity instanceof Zombie) && !(entity instanceof Skeleton))) { EntityDamageEvent.DamageCause cause = damage.getCause();
if (!Config.getConfig(entity.getWorld()).SKIP_GENERIC_DATA || (!(entity instanceof Zombie) && !(entity instanceof Skeleton)) || validDamageCauses.contains(cause)) {
skip = false; skip = false;
} }
@ -171,7 +175,6 @@ public final class EntityDeathListener extends Queue implements Listener {
} }
} }
else { else {
EntityDamageEvent.DamageCause cause = damage.getCause();
if (cause.equals(EntityDamageEvent.DamageCause.FIRE)) { if (cause.equals(EntityDamageEvent.DamageCause.FIRE)) {
e = "#fire"; e = "#fire";
} }
@ -189,6 +192,9 @@ public final class EntityDeathListener extends Queue implements Listener {
else if (cause.equals(EntityDamageEvent.DamageCause.MAGIC)) { else if (cause.equals(EntityDamageEvent.DamageCause.MAGIC)) {
e = "#magic"; e = "#magic";
} }
else if (cause.equals(EntityDamageEvent.DamageCause.WITHER)) {
e = "#wither_effect";
}
} }
if (entity instanceof ArmorStand) { if (entity instanceof ArmorStand) {
@ -224,7 +230,7 @@ public final class EntityDeathListener extends Queue implements Listener {
} }
} }
if (e.startsWith("#wither")) { if (e.startsWith("#wither") && !e.equals("#wither_effect")) {
e = "#wither"; e = "#wither";
} }