Solved Make a location produce particles?

Discussion in 'Plugin Development' started by Seemayr, Mar 24, 2014.

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

    Seemayr

    Hey guys,
    I just was wondering if there's a way to get a location/block produce particles (the way someone with a potion effect or something would do if you know what I mean).

    (It would be perfect If there's a way to get all Blocks/Location-points do that, which got a distance of 200 Blocks from the spawn.)

    I really hope you know what I mean. If you don't - don't hesitate to ask, I could try to explain it again of course.

    Thanks!
     
  2. Offline

    rfsantos1996

    https://github.com/rfsantos1996/MoarParticles/blob/master/src/com/jabyftw/mp/MoarParticles.java#L96

    This will create a block break effect, but other effects are similar
     
  3. Offline

    Seemayr

    rfsantos1996 Thanks, this works:
    Code:java
    1. world.playEffect(loc, Effect.MOBSPAWNER_FLAMES, 5);


    But this only creates particles one time and then it stops.
    Is there a way to produce them permanently or every 2 seconds or something? Do I need a Scheduler for that?
     
  4. Offline

    Mysticate

    Schedual a repeating task! Or if you want to have those particles while that block isn't air, do

    while (!loc.getBlock().getType().equals(Material.AIR){
    loc.getWorld().playEffect(loc, Effect.MOBSPAWNER_FLAMES, 5);
    }
     
  5. Offline

    Seemayr



    Thank you, did it now and worked:

    Code:java
    1. getServer().getScheduler().scheduleAsyncRepeatingTask(this, new Runnable() {
    2. @Override
    3. public void run() {
    4. world.playEffect(l, Effect.MOBSPAWNER_FLAMES, 5);
    5. }
    6. }, 10L, 30L);
     
  6. Offline

    Mysticate

  7. Offline

    Norbu10

    Only 1 problem :

    Code:java
    1. scheduleAsyncRepeatingTask


    Dont use Async!

    Use something like this :
    Code:java
    1. Bukkit.getScheduler().scheduleSyncRepeatingTask(main,
    2. new Runnable() {
    3. public void run() {
    4. }
    5. }, 20, 2 * 20);
     
Thread Status:
Not open for further replies.

Share This Page