Class 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
      void attachScript​(Script script, BreakProfile profile)
      Attaches a script to the break handler with a specific profile.
      void detachScript()
      Detaches the current script from the break handler.
      void initialize()
      Initializes the break handler and registers it to the event bus.
      boolean isActive()
      Checks if the handler is currently managing a script.
      boolean isOnBreak()
      Checks if currently on break.
      void onGameStateChanged​(net.runelite.api.events.GameStateChanged event)  
      void onGameTick​(net.runelite.api.events.GameTick event)  
      void shutdown()
      Shuts down the break handler and cleans up resources.
      boolean triggerBreak​(java.lang.String reason)
      Manually triggers a break.
      • Methods inherited from class java.lang.Object

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

      • BreakManager

        public BreakManager()
    • 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 class
        profile - 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.