Skip to content

Commit 011865d

Browse files
committed
Fixed IncompatibleClassChangeError on entity kills for MC 1.21.1 and earlier
1 parent 9958d37 commit 011865d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/main/java/net/coreprotect/listener/entity/EntityDeathListener.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import org.bukkit.Color;
1111
import org.bukkit.Location;
1212
import org.bukkit.Material;
13+
import org.bukkit.Registry;
1314
import org.bukkit.World;
1415
import org.bukkit.attribute.Attributable;
1516
import org.bukkit.attribute.Attribute;
@@ -64,6 +65,8 @@
6465
import org.bukkit.inventory.meta.LeatherArmorMeta;
6566
import org.bukkit.projectiles.ProjectileSource;
6667

68+
import com.google.common.collect.Lists;
69+
6770
import net.coreprotect.CoreProtect;
6871
import net.coreprotect.bukkit.BukkitAdapter;
6972
import net.coreprotect.config.Config;
@@ -283,8 +286,7 @@ else if (entity instanceof Player) {
283286

284287
if (entity instanceof Attributable) {
285288
Attributable attributable = entity;
286-
287-
for (Attribute attribute : Attribute.values()) {
289+
for (Attribute attribute : Lists.newArrayList(Registry.ATTRIBUTE)) {
288290
AttributeInstance attributeInstance = attributable.getAttribute(attribute);
289291
if (attributeInstance != null) {
290292
List<Object> attributeData = new ArrayList<>();

0 commit comments

Comments
 (0)