Class ChunkParticlesSpawner
java.lang.Object
me.tayebyassine.homestead.borders.particles.ChunkParticlesSpawner
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
ConstructorsConstructorDescriptionChunkParticlesSpawner(org.bukkit.entity.Player player) Creates a new chunk particles spawner for the given player. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcancelTask(org.bukkit.entity.Player player) Cancels the active particle task for the given player.static TaskHandlegetTask(org.bukkit.entity.Player player) Gets the current task handle for a player, if any.static booleanisTaskRunning(org.bukkit.entity.Player player) Checks if a particle task is currently running for the given player.voidSpawns border particles for all regions in the player's world.
-
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
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.
-