public interface HealEntityEvent extends TargetEntityEvent, Cancellable, CauseTracked
Entity
is "healed". This can usually mean that
after a certain amount of "heal amount" the entity is destroyed. Similar to
the InteractEntityEvent.Attack
, 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<Tuple<HealthModifier,java.util.function.Function<? super Double,Double>>> |
getModifiers()
|
double |
getOriginalFinalHealAmount()
Gets the original "final" amount of healing after all original
HealthModifier s are applied to getOriginalHealAmount() ()}. |
List<Tuple<HealthModifier,java.util.function.Function<? super Double,Double>>> |
getOriginalFunctions()
|
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,
java.util.function.Function<? super Double,Double> function)
ns the provided
Function to be used for the given
HealthModifier . |
getTargetEntity
isCancelled, setCancelled
getCause
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 Function.apply(Object)
available from all
the Tuple
s of HealthModifier
to Function
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<Tuple<HealthModifier,java.util.function.Function<? super Double,Double>>> getOriginalFunctions()
double getBaseHealAmount()
Entity
.
The "base" heal amount is the original value before passing along the chain
of Function
s for all known HealthModifier
s.void setBaseHealAmount(double healAmount)
Entity
.
The "base" heal amount is the original value passed along the chain of
Function
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, java.util.function.Function<? super Double,Double> function)
Function
to be used for the given
HealthModifier
. If the HealthModifier
is already
included in getModifiers()
, the Function
replaces
the existing function. If there is no Tuple
for the
HealthModifier
, a new one is created and added to the end
of the list of Function
s to be applied to the
getBaseHealAmount()
.
If needing to create a custom HealthModifier
is required,
usage of the HealthModifierBuilder
is recommended.
healthModifier
- The heal amount modifierfunction
- The function to map to the modifierList<Tuple<HealthModifier,java.util.function.Function<? super Double,Double>>> getModifiers()
Tuple
s of HealthModifier
keyed to
their representative Function
s. All HealthModifier
s are
applicable to the entity based on the HealingSource
and any
possible invulnerabilities due to the HealingSource
.