diff --git a/explodingarrows/src/com/gmail/goodfaceforradio/explodingarrows/ExplodingArrows.java b/explodingarrows/src/com/gmail/goodfaceforradio/explodingarrows/ExplodingArrows.java index 4eb17da..b854f3e 100644 --- a/explodingarrows/src/com/gmail/goodfaceforradio/explodingarrows/ExplodingArrows.java +++ b/explodingarrows/src/com/gmail/goodfaceforradio/explodingarrows/ExplodingArrows.java @@ -53,18 +53,17 @@ public void onProjectileHit(ProjectileHitEvent event) { Player player; // Only interested in arrows. - try { - arrow = (Arrow) projectile; - } catch (ClassCastException e) { + if(!(projectile instanceof Arrow)) { return; } + + arrow = (Arrow) projectile; // Only interested in players shooting. - try { - player = (Player) arrow.getShooter(); - } catch (ClassCastException e) { + if(!(arrow.getShooter() instanceof Player)) { return; } + player = (Player) arrow.getShooter(); // Player needs to have one or more blaze rods in inventory to // get exploding arrows. @@ -105,4 +104,4 @@ public void onPlayerUse(PlayerInteractEvent event){ this.bGrantedArrow = 1; } } -} \ No newline at end of file +}