public interface HealEntityEvent extends TargetEntityEvent, Cancellable
Entity
is "healed". This can usually mean that
after a certain amount of "heal amount" the entity is destroyed. Similar to
the DamageEntityEvent
, this event uses various modifiersModifier and Type | Method and Description |
---|---|
double |
getBaseHealAmount()
Gets the "base" healing amount to apply to the targeted
Entity . |
double |
getFinalHealAmount()
Gets the final heal amount that will be applied to the entity.
|
double |
getHealAmount(HealthModifier healthModifier)
Gets the heal amount for the provided
HealthModifier . |
List<HealthFunction> |
getModifiers()
Gets a list of simple
HealthFunction s. |
double |
getOriginalFinalHealAmount()
Gets the original "final" amount of healing after all original
HealthModifier s are applied to getOriginalHealAmount() . |
List<HealthFunction> |
getOriginalFunctions()
Gets the original
List of HealthFunction s that was
originally passed into the event. |
double |
getOriginalHealAmount()
Gets the original amount to "heal" the targeted
Entity . |
Map<HealthModifier,Double> |
getOriginalHealingAmounts()
Gets an
Map of all original HealthModifier s and their
associated "modified" heal amount. |
double |
getOriginalHealingModifierAmount(HealthModifier healthModifier)
Gets the original healing amount for the provided
HealthModifier . |
boolean |
isModifierApplicable(HealthModifier healthModifier)
Checks whether the provided
HealthModifier is applicable to the
current available HealthModifier s. |
void |
setBaseHealAmount(double healAmount)
Sets the "base" healing amount to apply to the targeted
Entity . |
void |
setHealAmount(HealthModifier healthModifier,
DoubleUnaryOperator function)
Sets the provided
DoubleUnaryOperator to be used for the given
HealthModifier . |
getTargetEntity
getCause, getContext, getSource
isCancelled, setCancelled
double getOriginalHealAmount()
Entity
.double getOriginalFinalHealAmount()
HealthModifier
s are applied to getOriginalHealAmount()
.
The "final" heal amount is considered the amount gained by the
Entity
, if health is tracked.Map<HealthModifier,Double> getOriginalHealingAmounts()
Map
of all original HealthModifier
s and their
associated "modified" heal amount. Note that ordering is not retained.double getFinalHealAmount()
getBaseHealAmount()
being
applied in DoubleUnaryOperator.applyAsDouble(double)
available
from all the Tuple
s of HealthModifier
to
DoubleUnaryOperator
in getOriginalFunctions()
.double getOriginalHealingModifierAmount(HealthModifier healthModifier)
HealthModifier
.
If the provided HealthModifier
was not included in
getOriginalHealingAmounts()
, an IllegalArgumentException
is thrown.healthModifier
- The original healing modifierList<HealthFunction> getOriginalFunctions()
List
of HealthFunction
s that was
originally passed into the event.double getBaseHealAmount()
Entity
.
The "base" heal amount is the original value before passing along the
chain of DoubleUnaryOperator
s for all known
HealthModifier
s.void setBaseHealAmount(double healAmount)
Entity
.
The "base" heal amount is the original value passed along the chain of
DoubleUnaryOperator
s for all known HealthModifier
s.healAmount
- The base heal amountboolean isModifierApplicable(HealthModifier healthModifier)
HealthModifier
is applicable to the
current available HealthModifier
s.healthModifier
- The health modifier to checkdouble getHealAmount(HealthModifier healthModifier)
HealthModifier
. Providing
that isModifierApplicable(HealthModifier)
returns
true
, the cached "heal amount" for the
HealthModifier
is returned.healthModifier
- The heal amount modifier to get the heal amount forvoid setHealAmount(HealthModifier healthModifier, DoubleUnaryOperator function)
DoubleUnaryOperator
to be used for the given
HealthModifier
. If the HealthModifier
is already included
in getModifiers()
, the DoubleUnaryOperator
replaces the
existing function. If there is no HealthFunction
for the
HealthModifier
, a new one is created and added to the end of the
list of DoubleUnaryOperator
s to be applied to the
getBaseHealAmount()
.
If needing to create a custom HealthModifier
is required,
usage of the
HealthModifier.Builder
is recommended.
healthModifier
- The heal amount modifierfunction
- The function to map to the modifierList<HealthFunction> getModifiers()
HealthFunction
s. All HealthModifier
s are applicable to the entity based on the HealingSource
and any
possible invulnerabilities due to the HealingSource
.