Answers for "spigot spawn firework"

2

spigot spawn firework

public static void spawnFireworks(Location location, int amount) {
   Location loc = location;
   Firework fw = (Firework) loc.getWorld().spawnEntity(loc, EntityType.FIREWORK);
   FireworkMeta fwm = fw.getFireworkMeta();

  fwm.setPower(2);
  fwm.addEffect(FireworkEffect.builder().withColor(Color.LIME).flicker(true).build());

  fw.setFireworkMeta(fwm);
  fw.detonate();

  for(int i = 0;i<amount; i++){
    Firework fw2 = (Firework) loc.getWorld().spawnEntity(loc, EntityType.FIREWORK);
    fw2.setFireworkMeta(fwm);
  }
}
Posted by: Guest on May-14-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language