Class PrivBotPanel.Builder

java.lang.Object
privbot.ui.PrivBotPanel.Builder
Enclosing class:
PrivBotPanel

public static final class PrivBotPanel.Builder extends Object
  • Method Details

    • startStop

      public PrivBotPanel.Builder startStop(Runnable start, Runnable stop, BooleanSupplier running)
      The Start/Stop button. running is polled on every refresh, so the button follows the plugin's real state even when it stops by itself; there is no refresh() to call. All three run on the EDT: keep them quick and never block on the game.
    • settings

      public PrivBotPanel.Builder settings(Runnable openStudio)
      The standard Settings button (PrivBotPanel.SETTINGS_LABEL); openStudio runs on the EDT.
    • action

      public PrivBotPanel.Builder action(String label, Color accent, Runnable onClick)
      An extra action button below Settings.
    • stat

      public PrivBotPanel.Builder stat(String key, Supplier<?> value)
      A stat row whose value is read from value on every refresh (null renders "-"). The supplier runs on the EDT each refresh: return a cached value, never a client read. A supplier that throws renders "-".
    • runtime

      public PrivBotPanel.Builder runtime(String key, Supplier<Instant> startedAt)
      A stat row showing the time elapsed since startedAt (null start renders "-").
    • refreshEvery

      public PrivBotPanel.Builder refreshEvery(int millis)
      Refresh interval for pollers and stats; default 1000 ms, minimum 100 ms.
    • build

      public PrivBotPanel build()
      Creates the panel, polls once, and starts the refresh timer when anything needs polling. Stop the timer on shutdown (PluginUi.detach() does).