From b7d840939bab9acd10fe7e198f0d8c6eb2017842 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Sat, 14 Jan 2012 14:45:56 +0000 Subject: [PATCH] Fixed any chance of creatures .getTarget throwing a class cast exception - thanks to an old PR by garbagemule! By: Nathan Adams --- .../main/java/org/bukkit/craftbukkit/entity/CraftCreature.java | 1 + 1 file changed, 1 insertion(+) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftCreature.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftCreature.java index e4f263634a..f0d45c4704 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftCreature.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftCreature.java @@ -24,6 +24,7 @@ public class CraftCreature extends CraftLivingEntity implements Creature { public CraftLivingEntity getTarget() { if (getHandle().target == null) return null; + if (!(getHandle().target instanceof CraftLivingEntity)) return null; return (CraftLivingEntity) getHandle().target.getBukkitEntity(); }