Class Particle

java.lang.Object
valorless.rarespawns.datamodels.Particle

public class Particle extends Object
Data model describing a particle spawn configuration.

Encapsulates the particle key and basic spawn parameters: count, offset and extra. A convenience parse(String) method can construct an instance from a compact string format.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    Number of particle instances to spawn per call.
    Extra/speed parameter passed to the particle system.
    org.bukkit.Particle
    Namespaced key or identifier of the particle to spawn (e.g.
    Offset applied to X/Y/Z when spawning, used as spread.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Particle(String key, Integer count, Double offset, Double extra)
    Creates a particle configuration with explicit parameters.
  • Method Summary

    Modifier and Type
    Method
    Description
    static Particle
    parse(String string)
    Parses a particle specification string into a Particle instance.
    void
    spawn(org.bukkit.entity.Player player)
    Spawns this particle at the player's current location.
    void
    spawn(org.bukkit.Location location)
    Spawns this particle at the given world location.
    Returns a human-readable description of this particle configuration.

    Methods inherited from class java.lang.Object

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

    • key

      public org.bukkit.Particle key
      Namespaced key or identifier of the particle to spawn (e.g. "FLAME").
    • count

      public Integer count
      Number of particle instances to spawn per call.
    • offset

      public Double offset
      Offset applied to X/Y/Z when spawning, used as spread.
    • extra

      public Double extra
      Extra/speed parameter passed to the particle system.
  • Constructor Details

    • Particle

      public Particle(String key, Integer count, Double offset, Double extra)
      Creates a particle configuration with explicit parameters.
      Parameters:
      key - particle identifier (e.g., Bukkit particle key or name)
      count - number of particles to spawn
      offset - positional spread on each axis
      extra - extra/speed value for the particle
  • Method Details

    • parse

      public static Particle parse(String string)
      Parses a particle specification string into a Particle instance.

      Format: key[:count[:offset[:extra]]]

      • key: required particle identifier
      • count: integer (default 20)
      • offset: double spread for x/y/z (default 0.5)
      • extra: double extra/speed parameter (default 0.02)
      Invalid numeric fields fall back to their defaults and log an error.

      Parameters:
      string - the particle specification string
      Returns:
      a Particle instance with parsed or defaulted values
    • spawn

      public void spawn(org.bukkit.entity.Player player)
      Spawns this particle at the player's current location.

      Uses the configured count, offset (applied to x/y/z as spread), and extra parameters.

      Parameters:
      player - the player whose location is used for spawning
    • spawn

      public void spawn(org.bukkit.Location location)
      Spawns this particle at the given world location.

      Uses the configured count, offset (applied to x/y/z as spread), and extra parameters.

      Parameters:
      location - the target location for spawning particles
    • toString

      public String toString()
      Returns a human-readable description of this particle configuration.
      Overrides:
      toString in class Object