Fix Nukkit related compilation issue

This commit is contained in:
Aurora Lahtela 2024-11-30 10:57:33 +02:00
parent acd83a41c3
commit 7de29e72f9

View File

@ -18,8 +18,8 @@ package com.djrapitops.plan.gathering.listeners.nukkit;
import cn.nukkit.Player;
import cn.nukkit.entity.Entity;
import cn.nukkit.entity.EntityTameable;
import cn.nukkit.entity.item.EntityEndCrystal;
import cn.nukkit.entity.passive.EntityTameable;
import cn.nukkit.entity.projectile.EntityProjectile;
import cn.nukkit.event.EventHandler;
import cn.nukkit.event.EventPriority;
@ -131,13 +131,13 @@ public class DeathEventListener implements Listener {
EntityDamageEvent entityDamageEvent = dead.getLastDamageCause();
Entity killer = ((EntityDamageByEntityEvent) entityDamageEvent).getDamager();
if (killer instanceof Player) return getItemInHand((Player) killer);
if (killer instanceof EntityTameable) return getPetType((EntityTameable) killer);
if (killer instanceof EntityTameable) return getPetType(killer);
// EntityProjectile, EntityEndCrystal and all other causes that are not known yet
return new EntityNameFormatter().apply(killer.getName());
}
private String getPetType(EntityTameable tameable) {
private String getPetType(Entity tameable) {
return tameable.getName();
}
@ -156,7 +156,7 @@ public class DeathEventListener implements Listener {
}
private Optional<Player> getOwner(EntityTameable tameable) {
if (!tameable.isTamed()) {
if (!tameable.hasOwner()) {
return Optional.empty();
}