How do I make a firework explode immediately?

Discussion in 'Plugin Development' started by dkfredebang, Jul 17, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    dkfredebang

    So I am kinda new to the fireworks in bukkit. I was looking on how people would make the firework explode as soon as it get's spawned. I made this just to test it out, though even if I set the power to 0 it will still fly up a bit and show a trail then explode. What I want is to make the firework explode as soon as it spawns.

    Code:
                if(e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK) {
                    if(mat == Material.STICK){  
                        Firework f = (Firework) e.getPlayer().getWorld().spawn(e.getPlayer().getLocation(), Firework.class);
                        FireworkMeta fm = f.getFireworkMeta();
                        fm.addEffect(FireworkEffect.builder()  
                        .flicker(false)
                        .trail(false)
                        .with(Type.BALL_LARGE)
                        .withColor(Color.BLUE, Color.AQUA)
                        .build());
                    fm.setPower(0);
                    f.setFireworkMeta(fm);
                      
                      
                    }
                  
                }
     
  2. Offline

    ShadowLAX

Thread Status:
Not open for further replies.

Share This Page