Class ItemContainerSnapshot.Item

java.lang.Object
privbot.hooks.container.ItemContainerSnapshot.Item
Enclosing class:
ItemContainerSnapshot

public static final class ItemContainerSnapshot.Item extends Object
One occupied slot, by value.
  • Field Details

    • id

      public final int id
      Item id, slot index and stack quantity.
    • slot

      public final int slot
      Item id, slot index and stack quantity.
    • quantity

      public final int quantity
      Item id, slot index and stack quantity.
    • name

      public final String name
      The item's name as the player sees it ("" when unknown).
  • Constructor Details

    • Item

      public Item(int id, String name, int slot, int quantity, String... actions)
      Parameters:
      id - item id, positive
      name - item name (null: "")
      slot - slot index, non-negative
      quantity - stack quantity, positive
      actions - the item's menu actions (blanks dropped)
      Throws:
      IllegalArgumentException - for a non-positive id or quantity, or a negative slot
  • Method Details

    • actions

      public List<String> actions()
      Returns:
      the item's menu actions (unmodifiable)
    • hasAction

      public boolean hasAction(String wanted)
      Parameters:
      wanted - a menu action, case-insensitive
      Returns:
      whether the item lists it
    • nameMatches

      public boolean nameMatches(String wanted)
      A name saved before colour codes were stripped ("@gre@Coins") still matches "Coins".
    • nameContains

      public boolean nameContains(String wanted)
      Parameters:
      wanted - a name fragment (colour codes ignored), case-insensitive
      Returns:
      whether the name contains it; false for blank
    • toString

      public String toString()
      Overrides:
      toString in class Object