Class PrivBotAPI
One plugin model
Every PrivBot entry point extends RuneLite
Plugin. Inject PrivContext, create a
plugin-specific PrivTaskContext, and keep the runner/worker in a separate
task-tree class. The plugin retains normal RuneLite lifecycle, dependency
injection, configuration, panels, overlays, and EventBus subscriptions.
Runtime lifecycle
- Create RunState, services, TaskTree, panel, and overlay in
startUp(). - Start/stop the TaskTree, which forwards to
TaskNodeRunner.start()andTaskNodeRunner.stop(). - Forward
GameTickand game-state events from the plugin to the TaskTree. - Stop the worker and clean up nodes/UI from
shutDown().
Task contract
Use SimpleNode, Parent,
Child, or CompositeTaskNode.
Construct the runner in the TaskTree with the context object and the run-state gate,
new TaskNodeRunner<>(context, () -> runState.enabled), then call start(),
onGameTick() and stop(). Give each node a priority, preferably a
TaskPriorityBands name
(super("Eat Food", TaskPriorityBands.HAZARD_SECONDARY_HIGH)); higher wins and equal
values keep registration order.
shouldExecute is a read-only client-thread decision; execute runs on the script
worker and may use ctx.sleepUntil(...).
Versions
apiVersion() is the plugin API version of the PrivBot the plugin runs on
(ApiVersion.CURRENT); the version a plugin compiled against is its
Plugin-Api-Version manifest entry. Compatibility rules: the SDK docs, Versioning.
Hooks and interactions
PrivTaskContext exposes inventory, bank, NPCs, objects, ground items,
equipment, players, prayer, combat, skills, magic, widgets, dialogue, user, game, chat, vars,
travel, and workflows. Prefer intent methods such as npcs.attack("Chicken"),
inventory.eat("Shark") / eatFood(), groundItems.take("Feather"),
objects.interact("Bank booth", "Bank"), bank.depositInventory() /
bank.withdraw("Bronze axe", 1) / bank.close(),
players.interact("Name", "Trade"),
combat.attack("Name"), magic.cast("Wind Strike"),
magic.castOnNpc("Entangle", npc), inventory.useOn("Tinderbox", "Logs"),
prayer.flick("Protect from Melee"), shop.buy("Lobster", 10) / shop.sell("Shark", 10),
trade.offerAll("Shark") / trade.accept(),
teleporter.castTeleport("Varrock Teleport") / teleporter.teleportToItem("Varrock teleport"),
skills.boosted("Attack"), widgets.has("Continue") / widgets.interact("Continue") /
widgets.interact("Shark", "Value"), and travel.walkTo(tile).
Query terminal operations may return null. An interaction returning true means
dispatch was accepted; confirm the resulting game-state change.
-
Field Details
-
VERSION
Deprecated.useversion()so packaged and IDE builds share one version source.
-
-
Method Details
-
version
Build version of the privbot-sdk code module, ordevelopmentin an IDE build. This is not the API version; seeapiVersion(). -
apiVersion
The plugin API version this PrivBot provides, for example"1.0.0". Delegates toApiVersion.CURRENT, the single source the shared-lib manifest (PrivBot-Api-Version) is stamped from.
-
version()so packaged and IDE builds share one version source.