1 public static void spawnFireworks(Location location, int amount) {
2 Location loc = location;
3 Firework fw = (Firework) loc.getWorld().spawnEntity(loc, EntityType.FIREWORK);
4 FireworkMeta fwm = fw.getFireworkMeta();
5
6 fwm.setPower(2);
7 fwm.addEffect(FireworkEffect.builder().withColor(Color.LIME).flicker(true).build());
8
9 fw.setFireworkMeta(fwm);
10 fw.detonate();
11
12 for(int i = 0;i<amount; i++){
13 Firework fw2 = (Firework) loc.getWorld().spawnEntity(loc, EntityType.FIREWORK);
14 fw2.setFireworkMeta(fwm);
15 }
16}