Class SelectedAreaParticlesSpawner

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

public final class SelectedAreaParticlesSpawner extends Object
Handles particle spawning around a selected cuboid area for a specific player.

Visualizes a selection by spawning dust particles along all twelve edges of the cuboid defined by two corner blocks.

Task auto-cancels after 1 minute to prevent resource leaks from abandoned selections.

See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    SelectedAreaParticlesSpawner(org.bukkit.entity.Player player, SeBlock firstBlock, SeBlock secondBlock)
    Creates or updates the particle spawner for the given player using SeBlock corners (serializable block positions).
    SelectedAreaParticlesSpawner(org.bukkit.entity.Player player, org.bukkit.block.Block firstBlock, org.bukkit.block.Block secondBlock)
    Creates or updates the particle spawner for the given player using raw Block corners.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    cancelTask(org.bukkit.entity.Player player)
    Cancels the particle task for the given player.
    getSpawner(org.bukkit.entity.Player player)
    Gets the current spawner instance 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 dust particles along all twelve edges of the selected cuboid.
    static void
    updateSelection(org.bukkit.entity.Player player, SeBlock firstBlock, SeBlock secondBlock)
    Updates the selection corners for an existing spawner.

    Methods inherited from class Object

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

    • SelectedAreaParticlesSpawner

      public SelectedAreaParticlesSpawner(org.bukkit.entity.Player player, org.bukkit.block.Block firstBlock, org.bukkit.block.Block secondBlock)
      Creates or updates the particle spawner for the given player using raw Block corners.
      Parameters:
      player - the player to show the selection border for
      firstBlock - one corner of the selected area
      secondBlock - the opposite corner of the selected area
      Throws:
      IllegalArgumentException - if player is null
    • SelectedAreaParticlesSpawner

      public SelectedAreaParticlesSpawner(org.bukkit.entity.Player player, SeBlock firstBlock, SeBlock secondBlock)
      Creates or updates the particle spawner for the given player using SeBlock corners (serializable block positions).
      Parameters:
      player - the player to show the selection border for
      firstBlock - one corner of the selected area
      secondBlock - the opposite corner of the selected area
      Throws:
      IllegalArgumentException - if player is null
  • Method Details

    • cancelTask

      public static void cancelTask(org.bukkit.entity.Player player)
      Cancels the 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
    • getSpawner

      public static SelectedAreaParticlesSpawner getSpawner(org.bukkit.entity.Player player)
      Gets the current spawner instance for a player, if any.
      Parameters:
      player - the player
      Returns:
      the spawner, or null if none
    • updateSelection

      public static void updateSelection(org.bukkit.entity.Player player, SeBlock firstBlock, SeBlock secondBlock)
      Updates the selection corners for an existing spawner.

      If no spawner exists for the player, this does nothing.

      Parameters:
      player - the player
      firstBlock - new first corner
      secondBlock - new second corner
    • spawnParticles

      public void spawnParticles()
      Spawns dust particles along all twelve edges of the selected cuboid.

      Particles are spawned at block centers (offset by 0.5) for visual alignment.