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 ClassesModifier and TypeClassDescriptionstatic interfaceParticleSpawner.Builder<T extends ParticleSpawner>The builder used to create a certain type of ParticleSpawner. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionParticleSpawner(int repeatTimes, int delay, @NotNull org.bukkit.entity.Player source) -
Method Summary
Modifier and TypeMethodDescriptionabstract voidprotected abstract voiddisplay()Displays the actual particles.protected abstract voidonStop()Extra logic to be executed when the BukkitRunnable stops.voidrun()protected abstract booleanContains 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
-
Field Details
-
delay
public final int delayThe 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()
-