Class VarRegistry

java.lang.Object
privbot.hooks.VarRegistry

public final class VarRegistry extends Object
The evidence-backed names ctx.vars.byName(...) knows on one server.

Two sources, in priority order:

  1. the named varps and varbits PrivBot itself uses on this client (Impact, Elorin, SpawnPK), each checked against the server, and kept current when the client updates;
  2. a bundled list per server for the others (Orion), each entry checked against that server.

A name in neither is unknown, and byName answers UNREADABLE for it: an OSRS id is never assumed to hold on another server (Elorin's varbit ids are its own, OSRS raw + 22000; SpawnPK reads varbits as 0).

Names are matched case-insensitively with spaces, hyphens and underscores treated alike, so "run enabled" finds RUN_ENABLED. Sub-keys such as Varp.RUN_ENABLED.trueValues are not names. Immutable once built.

  • Field Details

  • Method Details

    • empty

      public static VarRegistry empty()
      Returns:
      a registry that knows no names
    • of

      public static VarRegistry of(Collection<VarRegistry.Entry> entries)
      Builds a registry from explicit entries (tests, or a plugin's own captured names). A later entry with the same name replaces an earlier one.
      Parameters:
      entries - the entries
      Returns:
      the registry
    • find

      public VarRegistry.Entry find(String name)
      Parameters:
      name - a name in any spelling
      Returns:
      the entry, or null when the name has no evidence-backed entry on this server
    • names

      public Set<String> names()
      Returns:
      every name known on this server, sorted
    • normalize

      public static String normalize(String name)
      Canonical spelling: upper case, runs of anything other than letters and digits become one underscore.
      Parameters:
      name - any spelling
      Returns:
      the canonical spelling ("" for null)