From b096dcfd8b90c84c50cdec47e3c9678ca36465fe Mon Sep 17 00:00:00 2001 From: fullwall Date: Tue, 16 Oct 2012 17:50:57 +0800 Subject: [PATCH] Fix spout compat --- src/main/java/net/citizensnpcs/npc/CitizensNPCRegistry.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/citizensnpcs/npc/CitizensNPCRegistry.java b/src/main/java/net/citizensnpcs/npc/CitizensNPCRegistry.java index e4e718953..3024d64fa 100644 --- a/src/main/java/net/citizensnpcs/npc/CitizensNPCRegistry.java +++ b/src/main/java/net/citizensnpcs/npc/CitizensNPCRegistry.java @@ -37,6 +37,7 @@ import net.citizensnpcs.npc.entity.CitizensWolfNPC; import net.citizensnpcs.npc.entity.CitizensZombieNPC; import net.citizensnpcs.util.ByIdArray; +import org.bukkit.craftbukkit.entity.CraftEntity; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; @@ -144,7 +145,10 @@ public class CitizensNPCRegistry implements NPCRegistry { public NPC getNPC(Entity entity) { if (entity == null) return null; - return entity instanceof NPCHolder ? ((NPCHolder) entity).getNPC() : null; + if (entity instanceof NPCHolder) + return ((NPCHolder) entity).getNPC(); + net.minecraft.server.Entity handle = ((CraftEntity) entity).getHandle(); + return handle instanceof NPCHolder ? ((NPCHolder) handle).getNPC() : null; } @Override