Skip to content

Commit

Permalink
Add debug statement to forwardingNPCHolder
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Mar 31, 2021
1 parent fa0cf4f commit 48a2763
Showing 1 changed file with 9 additions and 1 deletion.
Expand Up @@ -3,11 +3,19 @@
import org.bukkit.entity.Entity;

import net.citizensnpcs.api.npc.NPC;
import net.citizensnpcs.api.util.Messaging;
import net.citizensnpcs.npc.ai.NPCHolder;

public interface ForwardingNPCHolder extends NPCHolder, Entity {
@Override
default NPC getNPC() {
return ((NPCHolder) NMSImpl.getHandle(this)).getNPC();
net.minecraft.server.v1_16_R3.Entity handle = NMSImpl.getHandle(this);
if (!(handle instanceof NPCHolder)) {
if (Messaging.isDebugging()) {
Messaging.debug("ForwardingNPCHolder with an improper bukkit entity", this, handle);
}
return null;
}
return ((NPCHolder) handle).getNPC();
}
}

0 comments on commit 48a2763

Please sign in to comment.