Class NPCs

java.lang.Object
privbot.hooks.NPCs

public final class NPCs extends Object
Snapshot NPC hook: call query() for a fluent NPCQuery (filters, closest, player north/south/east/west). When you already hold one PrivNPC, use its localPlayer*Of() helpers for the same cardinal checks.
  • Method Details

    • query

      public NPCQuery query()
      Returns:
      a query over the loaded NPCs, read once on the client thread
    • closest

      public PrivNPC closest(Predicate<PrivNPC> pred)
      Closest NPC matching the predicate.
    • closest

      public PrivNPC closest(String... names)
      Closest NPC matching any of the supplied names, or null.
    • nearest

      public PrivNPC nearest(String... names)
    • exists

      public boolean exists(String... names)
      Whether an NPC matching any of the supplied names is currently loaded.
    • attackClosest

      public boolean attackClosest(String... names)
      Attacks the closest NPC matching any supplied name.
    • attack

      public boolean attack(String... names)
      Attacks the closest NPC matching any supplied name.
    • interact

      public boolean interact(String name, String action)
      Interacts with the closest NPC matching name using action.
    • withAction

      public NPCQuery withAction(String... actions)
      Start a query filtered to NPCs with at least one of the given actions.
    • withName

      public NPCQuery withName(String... names)
      Start a query filtered to NPCs matching the given name(s).
    • withId

      public NPCQuery withId(int... ids)
      Start a query filtered to NPCs matching the given ID(s).
    • hintArrowOnly

      public NPCQuery hintArrowOnly()
      Start a query filtered to only the hint arrow NPC.
    • nearest

      public static PrivNPC nearest(Predicate<PrivNPC> pred)
      Static lookup that needs no ctx.