Fireball help.

Discussion in 'Spigot Plugin Development' started by LegionShooter, May 3, 2015.

  1. Is there a way to remove the fire when a small fireball hits the ground?
     
  2. gigosaurus

    Supporter

    If you created the fireball you can do fireball.setIsIncendiary(false);
    Otherwise, look into cancelling BlockIgniteEvent if the ignite cause is a fireball.
     
  3. gigosaurus

    Supporter

    Show you code so we can see what's wrong.
     
  4. its from a kind of magical spell :p but here:
    Code (Text):
        final SmallFireball fireball = (SmallFireball)player.launchProjectile(SmallFireball.class);
        fireball.setVelocity(player.getLocation().getDirection().multiply(5));
         
        new BukkitRunnable()
        {
          public void run()
          {
            Location loc = fireball.getLocation();
            if (!fireball.isValid())
            {
              cancel();
              try
              {
              fireball.remove();
              {
                  InstantFirework.createFireworkEffect(FireworkEffect.builder().flicker(true).trail(true).with(FireworkEffect.Type.BALL_LARGE).withColor(Color.BLACK).withFade(Color.PURPLE).build(), loc);
                fireball.getWorld().createExplosion(fireball.getLocation().getX(), fireball.getLocation().getY() + 0.0D, fireball.getLocation().getZ(), 5.0F, false, false);
                fireball.remove();
              }
              }
              catch (Exception e)
              {
                e.printStackTrace();
              }
            }
          }
        }
        .runTaskTimer(Main.plugin, 0L, 1L);
        new BukkitRunnable()
        {

        public void run()
          {
            Location loc = fireball.getLocation();
            try
            {
              if (!fireball.isValid()) {
                cancel();
              }
              Particles.sendToLocation(Particles.BLUE_SPARKLE, loc, 0.7F, 0.7F, 0.7F, 1.0F, 260);

              Particles.sendToLocation(Particles.LARGE_SMOKE, loc, 1.0F, 1.0F, 1.0F, 0.15F, 180);
             
              InstantFirework.createFireworkEffect(FireworkEffect.builder().flicker(true).trail(false).with(FireworkEffect.Type.BURST).withColor(Color.PURPLE).withFade(Color.BLACK).build(), loc);
            }
            catch (Exception e)
            {
              e.printStackTrace();
            }
          }
        }
        .runTaskTimer(Main.plugin, 0L, 2L);
      }
    }
      }
    }
     
  5. gigosaurus

    Supporter

    Did you try adding fireball.setIsIncendiary(false); to just after you create it? Stick it on line 3 of what you posted there.
     
  6. like this:
    Code (Text):
        final SmallFireball fireball = (SmallFireball)player.launchProjectile(SmallFireball.class);
        fireball.setVelocity(player.getLocation().getDirection().multiply(5));
        fireball.setIsIncendiary(false);  
     
  7. gigosaurus

    Supporter

    Yeah, that worked when I tested it.
     
  8. nope not working by me
     
  9. You could do what @gigosaurus said above and have a BlockIgniteEvent and then cancel it if the blocks are in a certain radius of the explosion point of the fireball as a workaround if nothing else seems to be working.