Package dev.deepcore.challenge.session
Class ActionBarTickerService
java.lang.Object
dev.deepcore.challenge.session.ActionBarTickerService
Runs and manages a repeating action-bar broadcast task.
-
Constructor Summary
ConstructorsConstructorDescriptionActionBarTickerService(org.bukkit.plugin.Plugin plugin) Creates an action-bar ticker service. -
Method Summary
Modifier and TypeMethodDescriptionvoidclearActionBar(Iterable<? extends org.bukkit.entity.Player> players) Clears the action bar for all provided players.voidstart(BooleanSupplier shouldTick, Runnable tickWork, Supplier<net.kyori.adventure.text.Component> messageSupplier, Supplier<List<org.bukkit.entity.Player>> recipientsSupplier) Starts the ticker task that executes work and pushes action-bar updates.voidstop()Stops the active action-bar ticker task if one is running.
-
Constructor Details
-
ActionBarTickerService
public ActionBarTickerService(org.bukkit.plugin.Plugin plugin) Creates an action-bar ticker service.- Parameters:
plugin- plugin used to schedule ticker tasks
-
-
Method Details
-
start
public void start(BooleanSupplier shouldTick, Runnable tickWork, Supplier<net.kyori.adventure.text.Component> messageSupplier, Supplier<List<org.bukkit.entity.Player>> recipientsSupplier) Starts the ticker task that executes work and pushes action-bar updates.- Parameters:
shouldTick- predicate checked before each tick executiontickWork- work action to execute before broadcasting action barmessageSupplier- supplier for the action-bar messagerecipientsSupplier- supplier for players receiving action-bar updates
-
stop
public void stop()Stops the active action-bar ticker task if one is running. -
clearActionBar
Clears the action bar for all provided players.- Parameters:
players- players whose action bars should be cleared
-