java.lang.Object
com.github.darksoulq.abyssallib.world.advancement.criterion.ItemHasCriterion
All Implemented Interfaces:
AdvancementCriterion

public class ItemHasCriterion extends Object implements AdvancementCriterion
An advancement criterion ensuring the player has an item matching a specified predicate in their inventory.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Codec<ItemHasCriterion>
    The codec used for serializing and deserializing the item has criterion.
    The registered type definition for the item has criterion.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a new ItemHasCriterion.
  • Method Summary

    Modifier and Type
    Method
    Description
    Set<Class<? extends org.bukkit.event.Event>>
    Retrieves the specific Event class that this criterion listens for.
    Retrieves the type definition associated with this specific criterion instance.
    boolean
    isMet(org.bukkit.entity.Player player)
    Checks if the player's inventory contains at least one item matching the predicate.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.github.darksoulq.abyssallib.world.advancement.criterion.AdvancementCriterion

    isMet
  • Field Details

    • CODEC

      public static final Codec<ItemHasCriterion> CODEC
      The codec used for serializing and deserializing the item has criterion.
    • TYPE

      public static final CriterionType<ItemHasCriterion> TYPE
      The registered type definition for the item has criterion.
  • Constructor Details

    • ItemHasCriterion

      public ItemHasCriterion(ItemPredicate predicate)
      Constructs a new ItemHasCriterion.
      Parameters:
      predicate - The predicate defining the required item.
  • Method Details

    • getType

      public CriterionType<?> getType()
      Description copied from interface: AdvancementCriterion
      Retrieves the type definition associated with this specific criterion instance.
      Specified by:
      getType in interface AdvancementCriterion
      Returns:
      The CriterionType characterizing this instance.
    • isMet

      public boolean isMet(org.bukkit.entity.Player player)
      Checks if the player's inventory contains at least one item matching the predicate.
      Specified by:
      isMet in interface AdvancementCriterion
      Parameters:
      player - The player to evaluate.
      Returns:
      True if the condition is met.
    • getTargetEvents

      public Set<Class<? extends org.bukkit.event.Event>> getTargetEvents()
      Description copied from interface: AdvancementCriterion
      Retrieves the specific Event class that this criterion listens for. If this returns empty set, the criterion will be treated as global and evaluated on state changes.
      Specified by:
      getTargetEvents in interface AdvancementCriterion
      Returns:
      The set of target Event classes, or empty if not event-specific.