Class RunePouch


  • public class RunePouch
    extends java.lang.Object
    Represents the player's Rune Pouch, providing utilities to check and retrieve rune types and quantities.

    The RunePouch allows for efficient lookup of rune contents using Guava's in-memory cache to reduce redundant varbit reads.

    Includes methods for checking single and multiple rune requirements, with optional quantity checks.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  RunePouch.RuneSlot
      Enum representing the 3 rune slots inside the Rune Pouch.
    • Constructor Summary

      Constructors 
      Constructor Description
      RunePouch()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Map<java.lang.String,​java.lang.Integer> getAllRunes()
      Retrieves a map of all runes currently stored in the pouch.
      int getQuantity​(Rune rune)
      Retrieves the quantity of a specific rune contained within the pouch.
      boolean hasPouch()
      Checks if the player currently possesses a Rune Pouch in their inventory.
      boolean hasRune​(Rune rune)
      Determines if the pouch contains the specified rune.
      boolean hasRune​(Rune rune, int amount)
      Determines if the pouch contains at least the specified amount of a given rune.
      boolean hasRunes​(java.util.Collection<Rune> runes)
      Checks if the pouch contains all specified runes (any amount).
      boolean hasRunes​(Rune... runes)
      Varargs overload of hasRunes(Collection).
      boolean hasRunesWithAmount​(java.util.Map<Rune,​java.lang.Integer> requiredRunes)
      Checks if the pouch contains multiple runes with specific required quantities.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RunePouch

        public RunePouch()
    • Method Detail

      • hasPouch

        public boolean hasPouch()
        Checks if the player currently possesses a Rune Pouch in their inventory.
        Returns:
        true if the player has a Rune Pouch; otherwise false.
      • getQuantity

        public int getQuantity​(Rune rune)
        Retrieves the quantity of a specific rune contained within the pouch.
        Parameters:
        rune - The rune to check.
        Returns:
        The quantity of the specified rune, or 0 if not found or pouch is missing.
      • hasRune

        public boolean hasRune​(Rune rune)
        Determines if the pouch contains the specified rune.
        Parameters:
        rune - The rune to check.
        Returns:
        true if the rune exists in any slot; otherwise false.
      • hasRune

        public boolean hasRune​(Rune rune,
                               int amount)
        Determines if the pouch contains at least the specified amount of a given rune.
        Parameters:
        rune - The rune to check.
        amount - The required quantity.
        Returns:
        true if the pouch contains enough runes; otherwise false.
      • hasRunes

        public boolean hasRunes​(java.util.Collection<Rune> runes)
        Checks if the pouch contains all specified runes (any amount).
        Parameters:
        runes - The runes to check.
        Returns:
        true if all runes are present; otherwise false.
      • hasRunes

        public boolean hasRunes​(Rune... runes)
        Varargs overload of hasRunes(Collection).
        Parameters:
        runes - The runes to check.
        Returns:
        true if all runes are present; otherwise false.
      • hasRunesWithAmount

        public boolean hasRunesWithAmount​(java.util.Map<Rune,​java.lang.Integer> requiredRunes)
        Checks if the pouch contains multiple runes with specific required quantities.
        Parameters:
        requiredRunes - A map of rune - required quantity.
        Returns:
        true if all runes meet or exceed their required amounts; otherwise false.
      • getAllRunes

        public java.util.Map<java.lang.String,​java.lang.Integer> getAllRunes()
        Retrieves a map of all runes currently stored in the pouch.
        Returns:
        A map of rune names - quantities. Empty if no pouch or empty slots.