Class ChunkParticlesSpawner

java.lang.Object
me.tayebyassine.homestead.borders.particles.ChunkParticlesSpawner

public final class ChunkParticlesSpawner extends Object
Handles particle spawning around claimed region chunks for a specific player.

Creates a visual outline of region borders by spawning dust particles along chunk edges that border unclaimed or other regions. Runs on a repeating task that refreshes particles periodically.

Each player can have at most one active particle task. The task auto-cancels after a configurable timeout (default 3 minutes) to prevent resource leaks.

See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    ChunkParticlesSpawner(org.bukkit.entity.Player player)
    Creates a new chunk particles spawner for the given player.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    cancelTask(org.bukkit.entity.Player player)
    Cancels the active particle task for the given player.
    static TaskHandle
    getTask(org.bukkit.entity.Player player)
    Gets the current task handle for a player, if any.
    static boolean
    isTaskRunning(org.bukkit.entity.Player player)
    Checks if a particle task is currently running for the given player.
    void
    Spawns border particles for all regions in the player's world.

    Methods inherited from class Object

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

    • ChunkParticlesSpawner

      public ChunkParticlesSpawner(org.bukkit.entity.Player player)
      Creates a new chunk particles spawner for the given player.

      If a task is already running for this player, the existing task continues. The task will automatically stop after the configured timeout.

      Parameters:
      player - the player to show region borders for
      Throws:
      IllegalArgumentException - if player is null
  • Method Details

    • cancelTask

      public static void cancelTask(org.bukkit.entity.Player player)
      Cancels the active particle task for the given player.
      Parameters:
      player - the player whose task to cancel
    • isTaskRunning

      public static boolean isTaskRunning(org.bukkit.entity.Player player)
      Checks if a particle task is currently running for the given player.
      Parameters:
      player - the player to check
      Returns:
      true if a task is running
    • getTask

      public static TaskHandle getTask(org.bukkit.entity.Player player)
      Gets the current task handle for a player, if any.
      Parameters:
      player - the player
      Returns:
      the task handle, or null if none
    • spawnParticles

      public void spawnParticles()
      Spawns border particles for all regions in the player's world.

      Runs asynchronously to avoid blocking the main thread during region iteration.