Class Attribute
java.lang.Object
org.woftnw.eof.attribute.Attribute
- Direct Known Subclasses:
AttributeModifierAttribute, PotionEffectAttribute
Represents a tribal attribute.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected final @Nullable Predicate<org.bukkit.entity.Player> protected final boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidapply(org.bukkit.entity.Player player) Apply this attribute.booleanmeetsPredicate(@NonNull org.bukkit.entity.Player player) Check if the player meets the predicate, if there is one.voidtick(org.bukkit.entity.Player player) Tick this attribute.abstract voidunapply(org.bukkit.entity.Player player) Unapply this attribute.
-
Field Details
-
PREDICATE
-
REFRESH_ON_PREDICATE
protected final boolean REFRESH_ON_PREDICATE -
lastTest
protected boolean lastTest
-
-
Constructor Details
-
Attribute
public Attribute(@Nullable Predicate<org.bukkit.entity.Player> predicate, boolean refreshOnPredicate) Create a tribe attribute.- Parameters:
predicate- The predicate that must be true to apply the attribute or null if it should always be applied.refreshOnPredicate- Whether this attribute should only refresh when the predicate switches from false to true.
-
Attribute
Create a tribe attribute.- Parameters:
predicate- The predicate that must be true to apply the attribute or null if it should always be applied.
-
-
Method Details
-
meetsPredicate
public boolean meetsPredicate(@NonNull org.bukkit.entity.Player player) Check if the player meets the predicate, if there is one. Otherwise, this will return true.- Parameters:
player- The player to check.
-
tick
public void tick(org.bukkit.entity.Player player) Tick this attribute. Subclasses should usemeetsPredicate(player)in this method.- Parameters:
player- The player to apply to.
-
apply
public abstract void apply(org.bukkit.entity.Player player) Apply this attribute. This is only used when the player changes tribes or activates attributes. Subclasses should usemeetsPredicate(player)in this method.- Parameters:
player- The player to apply to.
-
unapply
public abstract void unapply(org.bukkit.entity.Player player) Unapply this attribute. This is only used when the player changes tribes or deactivates attributes. Subclasses should usemeetsPredicate(player)in this method.- Parameters:
player- The player to unapply to.
-