mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2025-02-16 04:11:33 +01:00
Add debug statement to forwardingNPCHolder
This commit is contained in:
parent
fa0cf4fc95
commit
48a2763a1b
@ -3,11 +3,19 @@ package net.citizensnpcs.nms.v1_16_R3.util;
|
|||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
|
|
||||||
import net.citizensnpcs.api.npc.NPC;
|
import net.citizensnpcs.api.npc.NPC;
|
||||||
|
import net.citizensnpcs.api.util.Messaging;
|
||||||
import net.citizensnpcs.npc.ai.NPCHolder;
|
import net.citizensnpcs.npc.ai.NPCHolder;
|
||||||
|
|
||||||
public interface ForwardingNPCHolder extends NPCHolder, Entity {
|
public interface ForwardingNPCHolder extends NPCHolder, Entity {
|
||||||
@Override
|
@Override
|
||||||
default NPC getNPC() {
|
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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user