Class StatisticCriterion

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

public class StatisticCriterion extends Object implements AdvancementCriterion
An advancement criterion evaluating a standard vanilla Minecraft statistic.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    The codec used for serializing and deserializing the vanilla statistic criterion.
    The registered type definition for the vanilla statistic criterion.
  • Constructor Summary

    Constructors
    Constructor
    Description
    StatisticCriterion(org.bukkit.Statistic statistic, int threshold)
    Constructs a new StatisticCriterion.
  • Method Summary

    Modifier and Type
    Method
    Description
    Retrieves the type definition associated with this specific criterion instance.
    boolean
    isMet(org.bukkit.entity.Player player)
    Checks if the player's vanilla statistic value meets or exceeds the required threshold.

    Methods inherited from class Object

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

    Methods inherited from interface AdvancementCriterion

    isMet
  • Field Details

    • CODEC

      public static final Codec<StatisticCriterion> CODEC
      The codec used for serializing and deserializing the vanilla statistic criterion.
    • TYPE

      public static final CriterionType<StatisticCriterion> TYPE
      The registered type definition for the vanilla statistic criterion.
  • Constructor Details

    • StatisticCriterion

      public StatisticCriterion(org.bukkit.Statistic statistic, int threshold)
      Constructs a new StatisticCriterion.
      Parameters:
      statistic - The vanilla statistic to track.
      threshold - The required value threshold.
  • Method Details

    • getType

      public CriterionType<?> getType()
      Description copied from interface: AdvancementCriterion
      Retrieves the type definition associated with this specific criterion instance. This is used for identifying the logic and serialization codec.
      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 vanilla statistic value meets or exceeds the required threshold.
      Specified by:
      isMet in interface AdvancementCriterion
      Parameters:
      player - The player to evaluate.
      Returns:
      True if the condition is met.