forked from elBukkit/EffectLib
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathExplodeEffect.java
More file actions
43 lines (33 loc) · 1.13 KB
/
ExplodeEffect.java
File metadata and controls
43 lines (33 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package de.slikey.effectlib.effect;
import org.bukkit.Sound;
import org.bukkit.Location;
import org.bukkit.Particle;
import de.slikey.effectlib.Effect;
import de.slikey.effectlib.EffectType;
import de.slikey.effectlib.EffectManager;
import de.slikey.effectlib.util.RandomUtils;
public class ExplodeEffect extends Effect {
public Particle particle1 = Particle.POOF;
public Particle particle2 = Particle.EXPLOSION_EMITTER;
/**
* Amount of spawned smoke-sparks
*/
public int amount = 25;
public Sound sound = Sound.ENTITY_GENERIC_EXPLODE;
public ExplodeEffect(EffectManager effectManager) {
super(effectManager);
type = EffectType.INSTANT;
speed = 0.5F;
}
@Override
public void onRun() {
Location location = getLocation();
if (location == null || location.getWorld() == null) {
cancel();
return;
}
location.getWorld().playSound(location, sound, 4.0F, (1.0F + (RandomUtils.random.nextFloat() - RandomUtils.random.nextFloat()) * 0.2F) * 0.7F);
display(particle1, location);
display(particle2, location);
}
}