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, false or an empty result. Unreadable is not a negative answer: confirm before acting on an absence.
  • An action verb returning true means 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 return false at once.
  • Batch a multi-read decision with ctx.read(...) (ReadScope); do not dispatch or wait inside it.
  • Class
    Description
    Static utility for thread-safe game state access — mirrors the dispatch layer of other bot frameworks.
    How GameThread gets a read onto a thread that may touch the client.
    The decisions GameThread makes, as pure functions of what a copy knows and where it is called from.
    What one GameThread copy knows at the moment of a call.
    Where a call runs.
    Guice module that binds PrivContext so a plugin injector can supply ctx.
    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 Unethicalite Time / DreamBot Sleep API.