Fixed IncompatibleClassChangeError on entity kills for MC 1.21.1 and earlier

This commit is contained in:
Intelli 2024-11-05 10:34:13 -07:00
parent 9958d372e3
commit 011865de56

View File

@ -10,6 +10,7 @@ import org.bukkit.Bukkit;
import org.bukkit.Color;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Registry;
import org.bukkit.World;
import org.bukkit.attribute.Attributable;
import org.bukkit.attribute.Attribute;
@ -64,6 +65,8 @@ import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.LeatherArmorMeta;
import org.bukkit.projectiles.ProjectileSource;
import com.google.common.collect.Lists;
import net.coreprotect.CoreProtect;
import net.coreprotect.bukkit.BukkitAdapter;
import net.coreprotect.config.Config;
@ -283,8 +286,7 @@ public final class EntityDeathListener extends Queue implements Listener {
if (entity instanceof Attributable) {
Attributable attributable = entity;
for (Attribute attribute : Attribute.values()) {
for (Attribute attribute : Lists.newArrayList(Registry.ATTRIBUTE)) {
AttributeInstance attributeInstance = attributable.getAttribute(attribute);
if (attributeInstance != null) {
List<Object> attributeData = new ArrayList<>();