Class SelectedAreaParticlesSpawner
java.lang.Object
tfagaming.projects.minecraft.homestead.borders.SelectedAreaParticlesSpawner
Handles particle spawning around a selected cuboid area for a specific player.
Each player has at most one persistent task running at any time. If a task is already active when the constructor is called, the selection corners are simply updated in-place; the existing task continues without interruption and will use the new coordinates on its very next tick. This avoids the cancel/restart cycle that was previously a source of lag and task-leak bugs.
Particle spawning runs on the main thread (or the player's entity thread on Folia) to keep all Bukkit API access thread-safe.
-
Constructor Summary
ConstructorsConstructorDescriptionSelectedAreaParticlesSpawner(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.SelectedAreaParticlesSpawner(org.bukkit.entity.Player player, SeBlock firstBlock, SeBlock secondBlock) Creates or updates the particle spawner for the given player usingSeBlockcorners. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcancelTask(org.bukkit.entity.Player player) Cancels the active particle task for the given player, if any.static voidcancelTask(TaskHandle task, org.bukkit.entity.Player player) Cancels the given task handle and removes the associated spawner from the tracking map.static booleanisTaskRunning(org.bukkit.entity.Player player) Returnstrueif a particle task is currently running for the given player, otherwisefalse.voidSpawns dust particles along all twelve edges of the selected cuboid.voidStarts the repeating task that drives particle spawning.
-
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
-
SelectedAreaParticlesSpawner
public SelectedAreaParticlesSpawner(org.bukkit.entity.Player player, SeBlock firstBlock, SeBlock secondBlock) Creates or updates the particle spawner for the given player usingSeBlockcorners.- Parameters:
player- The player to show the selection border forfirstBlock- One corner of the selected areasecondBlock- The opposite corner of the selected area
-
-
Method Details
-
cancelTask
Cancels the given task handle and removes the associated spawner from the tracking map.- Parameters:
task- The task handle to cancelplayer- The player associated with the task
-
cancelTask
public static void cancelTask(org.bukkit.entity.Player player) Cancels the active particle task for the given player, if any.- Parameters:
player- The player whose task should be cancelled
-
isTaskRunning
public static boolean isTaskRunning(org.bukkit.entity.Player player) Returnstrueif a particle task is currently running for the given player, otherwisefalse.- Parameters:
player- The player to check
-
spawnParticles
public void spawnParticles()Spawns dust particles along all twelve edges of the selected cuboid. -
startRepeatingEffect
public void startRepeatingEffect()Starts the repeating task that drives particle spawning.
-