Added some extra checks to Blood
Should resolve possible NPE and Material.AIR issues along
This commit is contained in:
parent
2d5868657a
commit
10e89a228e
|
@ -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());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue