Class SelectedAreaParticlesSpawner
java.lang.Object
me.tayebyassine.homestead.borders.particles.SelectedAreaParticlesSpawner
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
ConstructorsConstructorDescriptionSelectedAreaParticlesSpawner(org.bukkit.entity.Player player, SeBlock firstBlock, SeBlock secondBlock) Creates or updates the particle spawner for the given player usingSeBlockcorners (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 rawBlockcorners. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcancelTask(org.bukkit.entity.Player player) Cancels the particle task for the given player.static SelectedAreaParticlesSpawnergetSpawner(org.bukkit.entity.Player player) Gets the current spawner instance 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 dust particles along all twelve edges of the selected cuboid.static voidupdateSelection(org.bukkit.entity.Player player, SeBlock firstBlock, SeBlock secondBlock) Updates the selection corners for an existing spawner.
-
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 rawBlockcorners.- Parameters:
player- the player to show the selection border forfirstBlock- one corner of the selected areasecondBlock- 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 usingSeBlockcorners (serializable block positions).- Parameters:
player- the player to show the selection border forfirstBlock- one corner of the selected areasecondBlock- 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
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 playerfirstBlock- new first cornersecondBlock- 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.
-