Package privbot.context
@PublicApi
package privbot.context
Plugin-scoped runtime:
PrivContext and
GameThread.
PrivContext (ctx) holds one facade per game area
(ctx.inventory, ctx.npcs, ctx.bank and so on). Facade reads marshal onto the
thread that may touch the client through GameThread.ensure(java.util.function.Supplier<T>, T); which thread
that is depends on the server and is decided by GameThreadRouting.
Rules that hold for the whole API:
- A read that cannot be served returns
null,-1,falseor an empty result. Unreadable is not a negative answer: confirm before acting on an absence. - An action verb returning
truemeans the dispatch was accepted, not that the action happened. Confirm the state change with a later read. - Waits (
Time) and other blocking calls run on the script worker, never on the client thread; called there they returnfalseat once. - Batch a multi-read decision with
ctx.read(...)(ReadScope); do not dispatch or wait inside it.
-
ClassDescriptionStatic utility for thread-safe game state access — mirrors the dispatch layer of other bot frameworks.How
GameThreadgets a read onto a thread that may touch the client.The decisionsGameThreadmakes, as pure functions of what a copy knows and where it is called from.What oneGameThreadcopy knows at the moment of a call.Where a call runs.Guice module that bindsPrivContextso a plugin injector can supplyctx.Single entry point for scripts: hooks and timing helpers.Reuses detached observations within one synchronous decision, never across decisions or threads.Script-thread sleep utilities — matching the UnethicaliteTime/ DreamBotSleepAPI.