Class BreakManager
- java.lang.Object
-
- com.kraken.api.core.script.breakhandler.BreakManager
-
public class BreakManager extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description BreakManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidattachScript(Script script, BreakProfile profile)Attaches a script to the break handler with a specific profile.voiddetachScript()Detaches the current script from the break handler.voidinitialize()Initializes the break handler and registers it to the event bus.booleanisActive()Checks if the handler is currently managing a script.booleanisOnBreak()Checks if currently on break.voidonGameStateChanged(net.runelite.api.events.GameStateChanged event)voidonGameTick(net.runelite.api.events.GameTick event)voidshutdown()Shuts down the break handler and cleans up resources.booleantriggerBreak(java.lang.String reason)Manually triggers a break.
-
-
-
Method Detail
-
initialize
public void initialize()
Initializes the break handler and registers it to the event bus. Safe to call multiple times - will only initialize once.
-
shutdown
public void shutdown()
Shuts down the break handler and cleans up resources.
-
attachScript
public void attachScript(Script script, BreakProfile profile)
Attaches a script to the break handler with a specific profile. Prevents duplicate attachments and handles resuming from breaks.- Parameters:
script- An instance of a class extending the Script classprofile- The break profile to use
-
detachScript
public void detachScript()
Detaches the current script from the break handler.
-
onGameTick
@Subscribe public void onGameTick(net.runelite.api.events.GameTick event)
-
onGameStateChanged
@Subscribe public void onGameStateChanged(net.runelite.api.events.GameStateChanged event)
-
triggerBreak
public boolean triggerBreak(java.lang.String reason)
Manually triggers a break.- Parameters:
reason- The reason for why the break is being taken (this shows up in the logs).- Returns:
- True when a break was triggered successfully and false otherwise.
-
isActive
public boolean isActive()
Checks if the handler is currently managing a script.- Returns:
- True if there is an active script attached and false otherwise
-
isOnBreak
public boolean isOnBreak()
Checks if currently on break.- Returns:
- True if a break is currently being taken and false otherwise.
-
-