Firework Detonate

Discussion in 'Plugin Development' started by Elimnator, Nov 15, 2014.

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

    Elimnator

    I tried to detonate a firework with fw.detonate(); but when I do that the firework just disappears and doesn't show the explode effect.
     
  2. Offline

    xTrollxDudex

    Show code please
     
  3. Offline

    Elimnator

    xTrollxDudex Here:
    Code:java
    1. public void launchFirework(Player p, int speed) {
    2. Firework fw = (Firework) p.getWorld().spawn(p.getEyeLocation(), Firework.class);
    3. FireworkMeta meta = fw.getFireworkMeta();
    4. meta.addEffect(FireworkEffect.builder().withColor(Color.RED).with(Type.BALL_LARGE).build());
    5. fw.setFireworkMeta(meta);
    6. fw.setVelocity(p.getLocation().getDirection().multiply(speed));
    7. detonate(fw);
    8. }
    9.  
    10. public void detonate(final Firework fw){
    11. //Wait 1 Tick and Detontae
    12. Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() {
    13. public void run() {
    14. try{
    15. fw.detonate();
    16. }catch(Exception e){}
    17. }
    18. }, (1));
    19. }


    Bump

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 13, 2016
  4. Offline

    Konato_K

    In my personal experience detonate() glitches sometimes, it will work nice once and other times it wont, or at least I never got it to work 100% of the time, not sure if anyone did it or figured it out a way to make it work.
     
  5. Offline

    ferrybig

    Did you test using spigot or craftbukkit, from my tests, I know it was bugged inside spigot, and working using craftbukkit. If this is your case, you should create a new thread at the spigot forums, because I am sure the administrators here will close the post...
     
Thread Status:
Not open for further replies.

Share This Page