Added some extra checks to Blood

Should resolve possible NPE and Material.AIR issues along
This commit is contained in:
xGamingDudex 2016-02-16 18:48:27 +01:00
parent 2d5868657a
commit 10e89a228e
1 changed files with 16 additions and 10 deletions

View File

@ -53,6 +53,10 @@ public class Blood extends MiniPlugin
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
public void display(BloodEvent event) public void display(BloodEvent event)
{
if(event.isCancelled()) return;
if(event.getMaterial() != null && event.getMaterial() != Material.AIR)
{ {
for (int i = 0 ; i < event.getParticles() ; i++) for (int i = 0 ; i < event.getParticles() ; i++)
{ {
@ -65,10 +69,12 @@ public class Blood extends MiniPlugin
_blood.put(item, event.getTicks()); _blood.put(item, event.getTicks());
} }
}
if (event.getBloodStep()) if (event.getBloodStep())
event.getLocation().getWorld().playEffect(event.getLocation(), Effect.STEP_SOUND, 55); event.getLocation().getWorld().playEffect(event.getLocation(), Effect.STEP_SOUND, 55);
if(event.getSound() != null)
event.getLocation().getWorld().playSound(event.getLocation(), event.getSound(), event.getSoundVolume(), event.getSoundPitch()); event.getLocation().getWorld().playSound(event.getLocation(), event.getSound(), event.getSoundVolume(), event.getSoundPitch());
} }