Class ParticleSpawner

java.lang.Object
org.bukkit.scheduler.BukkitRunnable
net.mathias2246.buildmc.util.ParticleSpawner
All Implemented Interfaces:
Runnable

public abstract class ParticleSpawner extends org.bukkit.scheduler.BukkitRunnable
A class for defining custom per-player particle spawners.

These particles are only visible to the given player, and are spawned a set amount of times with a certain delay.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
    The builder used to create a certain type of ParticleSpawner.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final int
    The delay in ticks between each run.
    protected final @NotNull org.bukkit.entity.Player
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    ParticleSpawner(int repeatTimes, int delay, @NotNull org.bukkit.entity.Player source)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract void
     
    protected abstract void
    Displays the actual particles.
    protected abstract void
    Extra logic to be executed when the BukkitRunnable stops.
    void
    run()
     
    protected abstract boolean
    Contains conditions for when to exit the run loop early.

    Methods inherited from class org.bukkit.scheduler.BukkitRunnable

    cancel, getTaskId, isCancelled, runTask, runTaskAsynchronously, runTaskLater, runTaskLaterAsynchronously, runTaskTimer, runTaskTimerAsynchronously

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • delay

      public final int delay
      The delay in ticks between each run.
    • source

      @NotNull protected final @NotNull org.bukkit.entity.Player source
  • Constructor Details

    • ParticleSpawner

      public ParticleSpawner(int repeatTimes, int delay, @NotNull @NotNull org.bukkit.entity.Player source)
  • Method Details

    • buildParticleSpawner

      public abstract void buildParticleSpawner()
    • shouldStop

      protected abstract boolean shouldStop()
      Contains conditions for when to exit the run loop early.

      When this method returns true, the BukkitRunnable will stop.

    • display

      protected abstract void display()
      Displays the actual particles.
    • onStop

      protected abstract void onStop()
      Extra logic to be executed when the BukkitRunnable stops.

      E.g. removing metadata, or similar

    • run

      public void run()