Check if fired projectile is a WitherSkull before casting

Steps to reproduce:
1) Go to Wither Assult
2) Fire enderpearl
This commit is contained in:
samczsun 2017-02-26 13:45:45 -05:00 committed by cnr
parent c4bb9a23d5
commit 2e23d59702
1 changed files with 7 additions and 3 deletions

View File

@ -255,11 +255,15 @@ public class WitherGame extends TeamGame implements IBlockRestorer
if (GetState() == GameState.Recruit || GetState() == GameState.Prepare)
{
Projectile proj = event.getEntity();
WitherSkull ws = (WitherSkull) proj;
if (ws.getShooter() instanceof Wither)
if (proj instanceof WitherSkull)
{
event.setCancelled(true);
WitherSkull ws = (WitherSkull) proj;
if (ws.getShooter() instanceof Wither)
{
event.setCancelled(true);
}
}
}
}