From 12faebca2789080d2e8a5d3f5cde847842666a99 Mon Sep 17 00:00:00 2001 From: bm01 Date: Sun, 3 Feb 2013 06:00:12 +0100 Subject: [PATCH] Fixed PlayerFishEvent.getCaught() ClassCastException --- .../java/com/gmail/nossr50/listeners/PlayerListener.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java index 8ad95d906..1250dd2f9 100644 --- a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java @@ -2,6 +2,7 @@ package com.gmail.nossr50.listeners; import org.bukkit.Material; import org.bukkit.block.Block; +import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -94,9 +95,10 @@ public class PlayerListener implements Listener { break; case CAUGHT_ENTITY: - if (skillLevel >= AdvancedConfig.getInstance().getShakeUnlockLevel() && Permissions.shakeMob(player)) { - //TODO: Unsafe cast? - Fishing.beginShakeMob(player, (LivingEntity) event.getCaught(), skillLevel); + Entity entity = event.getCaught(); + + if (entity instanceof LivingEntity && skillLevel >= AdvancedConfig.getInstance().getShakeUnlockLevel() && Permissions.shakeMob(player)) { + Fishing.beginShakeMob(player, (LivingEntity) entity, skillLevel); } break;