Class PluginUi
java.lang.Object
privbot.ui.PluginUi
The plugin-side wiring every sidebar needed: build the panel on the EDT, add the navigation
button, and take both down again on
shutDown().
// startUp()
ui = PluginUi.attach(clientToolbar, "Scurrius", () -> PrivBotPanel.builder("Scurrius")
.startStop(this::start, this::stop, this::isEnabled)
.settings(this::openStudio)
.stat("Kills", this::getKillCount)
.build(), ScurriusPlugin.class, "/privbot/scurrius/icon.png");
// shutDown()
if (ui != null) { ui.detach(); ui = null; }
The panel supplier runs on the EDT (inline when already there, else invokeAndWait);
the icon falls back to the shared PrivBot mark when the resource is missing, so a plugin without
art still gets a button.
-
Method Summary
Modifier and TypeMethodDescriptionstatic PluginUiattach(net.runelite.client.ui.ClientToolbar toolbar, String title, Supplier<PrivBotPanel> panelFactory, Class<?> resourceOwner, String iconResource) Build the panel on the EDT and add its navigation button.static PluginUiattach(net.runelite.client.ui.ClientToolbar toolbar, String title, PrivBotPanel panel, Class<?> resourceOwner, String iconResource) attach(ClientToolbar, String, Supplier, Class, String)for an already-built panel.net.runelite.client.ui.NavigationButtonbutton()The navigation button added to the client toolbar.voiddetach()Remove the navigation button and stop the panel's timers; safe to call twice.static <T> TRunworkon the EDT and return its result (inline when already on the EDT).panel()The sidebar panel this handle attached.
-
Method Details
-
attach
public static PluginUi attach(net.runelite.client.ui.ClientToolbar toolbar, String title, Supplier<PrivBotPanel> panelFactory, Class<?> resourceOwner, String iconResource) Build the panel on the EDT and add its navigation button.- Parameters:
toolbar- the injectedClientToolbartitle- tooltip / display namepanelFactory- builds the panel; runs on the EDTresourceOwner- class whose classloader resolvesiconResourceiconResource- absolute resource path of the icon, or null for the shared mark
-
attach
public static PluginUi attach(net.runelite.client.ui.ClientToolbar toolbar, String title, PrivBotPanel panel, Class<?> resourceOwner, String iconResource) attach(ClientToolbar, String, Supplier, Class, String)for an already-built panel. -
panel
The sidebar panel this handle attached. -
button
public net.runelite.client.ui.NavigationButton button()The navigation button added to the client toolbar. -
detach
public void detach()Remove the navigation button and stop the panel's timers; safe to call twice. -
onEdt
Runworkon the EDT and return its result (inline when already on the EDT).
-