spigot spawn firework

Solutions on MaxInterview for spigot spawn firework by the best coders in the world

showing results for - "spigot spawn firework"
Mika
06 Jan 2021
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}