I am trying to detect when an npc is being attacked. For this I have a listener:
@EventHandler
public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
LOTM.getLogUtil().debug(event.getEntity().getUniqueId() + " Entity UUID --- " + getUuid() + " NPC UUID");
if(event.getEntity().getUniqueId() != getUuid()) return;
LOTM.getLogUtil().debug("NPC attacked");
And this is the getUUID function:
@Override
public UUID getUuid() {
this.uuid = npc.getUniqueId();
return uuid;
}
However when hitting the npc, the UUIDS dont match and there will be a difference in one single character:
[DEBUG] b2571c87-a511-23b4-9cc5-40089150f96d Entity UUID --- b2571c87-a511-43b4-9cc5-40089150f96d NPC UUID
I know that I could simply comnpare the entities but I'm still curious to know what's wrong here