Class PotionEffectCriterion
java.lang.Object
com.github.darksoulq.abyssallib.world.advancement.criterion.PotionEffectCriterion
- All Implemented Interfaces:
AdvancementCriterion
An advancement criterion ensuring a player currently has a specific potion effect active.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Codec<PotionEffectCriterion> The codec used for serializing and deserializing the potion effect criterion.static final CriterionType<PotionEffectCriterion> The registered type definition for the potion effect criterion. -
Constructor Summary
ConstructorsConstructorDescriptionPotionEffectCriterion(org.bukkit.potion.PotionEffectType effect) Constructs a new PotionEffectCriterion. -
Method Summary
Modifier and TypeMethodDescriptionRetrieves the specific Event class that this criterion listens for.getType()Retrieves the type definition associated with this specific criterion instance.booleanisMet(org.bukkit.entity.Player player) Checks if the player currently has the target potion effect active.Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface AdvancementCriterion
isMet
-
Field Details
-
CODEC
The codec used for serializing and deserializing the potion effect criterion. -
TYPE
The registered type definition for the potion effect criterion.
-
-
Constructor Details
-
PotionEffectCriterion
public PotionEffectCriterion(org.bukkit.potion.PotionEffectType effect) Constructs a new PotionEffectCriterion.- Parameters:
effect- The required potion effect type.
-
-
Method Details
-
getType
Description copied from interface:AdvancementCriterionRetrieves the type definition associated with this specific criterion instance.- Specified by:
getTypein interfaceAdvancementCriterion- Returns:
- The
CriterionTypecharacterizing this instance.
-
isMet
public boolean isMet(org.bukkit.entity.Player player) Checks if the player currently has the target potion effect active.- Specified by:
isMetin interfaceAdvancementCriterion- Parameters:
player- The player to evaluate.- Returns:
- True if the condition is met.
-
getTargetEvents
Description copied from interface:AdvancementCriterionRetrieves 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:
getTargetEventsin interfaceAdvancementCriterion- Returns:
- The set of target
Eventclasses, or empty if not event-specific.
-