mirror of
https://github.com/PlayPro/CoreProtect.git
synced 2024-11-21 01:13:45 +08:00
Fixed NotSerializableException when sacrificing entities (fixes #666)
This commit is contained in:
parent
ad4b0ddf24
commit
2780a9af27
@ -289,7 +289,7 @@ public final class EntityDeathListener extends Queue implements Listener {
|
||||
if (attributeInstance != null) {
|
||||
List<Object> attributeData = new ArrayList<>();
|
||||
List<Object> attributeModifiers = new ArrayList<>();
|
||||
attributeData.add(attributeInstance.getAttribute());
|
||||
attributeData.add(BukkitAdapter.ADAPTER.getRegistryKey(attributeInstance.getAttribute()));
|
||||
attributeData.add(attributeInstance.getBaseValue());
|
||||
|
||||
for (AttributeModifier modifier : attributeInstance.getModifiers()) {
|
||||
|
@ -166,7 +166,13 @@ public class EntityUtil {
|
||||
for (Object value : attributes) {
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Object> attributeData = (List<Object>) value;
|
||||
Attribute attribute = (Attribute) attributeData.get(0);
|
||||
Attribute attribute = null;
|
||||
if (attributeData.get(0) instanceof Attribute) {
|
||||
attribute = (Attribute) attributeData.get(0);
|
||||
}
|
||||
else {
|
||||
attribute = (Attribute) BukkitAdapter.ADAPTER.getRegistryValue((String) attributeData.get(0), Attribute.class);
|
||||
}
|
||||
Double baseValue = (Double) attributeData.get(1);
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Object> attributeModifiers = (List<Object>) attributeData.get(2);
|
||||
|
Loading…
Reference in New Issue
Block a user