Class Blackboard

java.lang.Object
privbot.hooks.Blackboard

public final class Blackboard extends Object
Run/script-scoped key-value scratchpad ("memory") for workflow flows and plugins.

Distinct from the Vars hook, which reads live game varbits/varps. A Blackboard is created empty per workflow run (shared between the action executor and condition evaluator) and carries author-defined state across steps and loop iterations — counters, a chosen target item, etc.

Backed by a ConcurrentHashMap: the workflow runner thread sets/reads while a condition evaluator on another thread may read concurrently. Keys are plain strings; values are arbitrary objects. null keys are ignored (no-op / default) so callers need not null-check.

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Removes all entries.
    get(String key)
    Returns the raw value for key, or null if absent (or key is null).
    int
    getInt(String key, int def)
    Returns the value at key coerced to an int: a Number is truncated, a numeric String is parsed; anything else (absent, null key, non-numeric) returns def.
    getString(String key, String def)
    Returns the value at key as a string: a String is returned as-is, any other non-null value is stringified via String.valueOf(Object); absent/null returns def.
    boolean
    has(String key)
    True if key is present (and non-null).
    int
    increment(String key, int by)
    Adds by to the int value at key, creating it at 0 if absent (or if the existing value is non-numeric), stores the result, and returns the new value.
    void
    set(String key, Object value)
    Stores value under key.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Blackboard

      public Blackboard()
  • Method Details

    • set

      public void set(String key, Object value)
      Stores value under key. A null key is ignored. A null value removes the key.
    • get

      public Object get(String key)
      Returns the raw value for key, or null if absent (or key is null).
    • getInt

      public int getInt(String key, int def)
      Returns the value at key coerced to an int: a Number is truncated, a numeric String is parsed; anything else (absent, null key, non-numeric) returns def.
    • getString

      public String getString(String key, String def)
      Returns the value at key as a string: a String is returned as-is, any other non-null value is stringified via String.valueOf(Object); absent/null returns def.
    • increment

      public int increment(String key, int by)
      Adds by to the int value at key, creating it at 0 if absent (or if the existing value is non-numeric), stores the result, and returns the new value. A null key is a no-op that returns 0.
    • has

      public boolean has(String key)
      True if key is present (and non-null).
    • clear

      public void clear()
      Removes all entries. Called when a run ends.