Interface BlocksAttacksComponent
- All Superinterfaces:
ConfigurationSerializable
Represents a component which can turn any item into a shield-like item which
blocks attack damage.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface
A damage reduction for a specific set of damage types. -
Method Summary
Modifier and TypeMethodDescriptionaddDamageReduction
(Collection<DamageType> types, float base, float factor, float horizontalBlockingAngle) Add a new damage reduction to this component, which blocks specific types of attacks.addDamageReduction
(DamageType type, float base, float factor, float horizontalBlockingAngle) Add a new damage reduction to this component, which blocks specific types of attacks.addDamageReduction
(Tag<DamageType> tag, float base, float factor, float horizontalBlockingAngle) Add a new damage reduction to this component, which blocks specific types of attacks.float
Gets the delay on equip before this item will block attacks.Gets the sound to play when the item blocks an attack.Gets the type of damage that will bypass blocking by this item.Get the list ofDamageReductions
that apply to this item.float
Gets the multiplier applied to the item cooldown when attacked by a disabling attack.Gets the sound to play when the item is disabled.float
Gets the constant amount of damage applied to the item if the threshold is reached.float
Gets the proportion of damage applied to the item if the threshold is reached.float
Gets the amount of damage required to be dealt before damage is also applied to the item.boolean
Remove the givenBlocksAttacksComponent.DamageReduction
from this item.void
setBlockDelaySeconds
(float seconds) Sets the delay on equip before this item will block attacks.void
setBlockSound
(Sound sound) Sets the sound to play when the item blocks an attack.void
setBypassedBy
(Tag<DamageType> tag) Sets the type of damage that will bypass blocking by this item.void
Set the list ofDamageReductions
to apply to this item.void
setDisableCooldownScale
(float scale) Sets the multiplier applied to the item cooldown when attacked by a disabling attack.void
setDisableSound
(Sound sound) Sets the sound to play when the item is disabled.void
setItemDamageBase
(float base) Sets the constant amount of damage applied to the item if the threshold is reached.void
setItemDamageFactor
(float factor) Sets the proportion of damage applied to the item if the threshold is reached.void
setItemDamageThreshold
(float threshold) Sets the amount of damage required to be dealt before damage is also applied to the item.Methods inherited from interface org.bukkit.configuration.serialization.ConfigurationSerializable
serialize
-
Method Details
-
getBlockDelaySeconds
float getBlockDelaySeconds()Gets the delay on equip before this item will block attacks.- Returns:
- the delay in seconds
-
setBlockDelaySeconds
void setBlockDelaySeconds(float seconds) Sets the delay on equip before this item will block attacks.- Parameters:
seconds
- the delay in seconds to set
-
getDisableCooldownScale
float getDisableCooldownScale()Gets the multiplier applied to the item cooldown when attacked by a disabling attack.- Returns:
- the scale
-
setDisableCooldownScale
void setDisableCooldownScale(float scale) Sets the multiplier applied to the item cooldown when attacked by a disabling attack.- Parameters:
scale
- the scale to set. Must be 0 or a positive integer
-
getDamageReductions
Get the list ofDamageReductions
that apply to this item.- Returns:
- all damage reductions. The mutability of the returned list cannot be guaranteed, but its contents are mutable and can have their values changed
-
setDamageReductions
Set the list ofDamageReductions
to apply to this item. This will remove any existing damage reductions.- Parameters:
reductions
- the reductions to set
-
addDamageReduction
@NotNull BlocksAttacksComponent.DamageReduction addDamageReduction(@NotNull DamageType type, float base, float factor, float horizontalBlockingAngle) Add a new damage reduction to this component, which blocks specific types of attacks.- Parameters:
type
- the type of attackbase
- the constant amount of damage to be blockedfactor
- the proportion of damage to be blockedhorizontalBlockingAngle
- the maximum angle at which attacks will be blocked- Returns:
- the
BlocksAttacksComponent.DamageReduction
instance that was added to this item
-
addDamageReduction
@NotNull BlocksAttacksComponent.DamageReduction addDamageReduction(@NotNull Collection<DamageType> types, float base, float factor, float horizontalBlockingAngle) Add a new damage reduction to this component, which blocks specific types of attacks.- Parameters:
types
- the types of attackbase
- the constant amount of damage to be blockedfactor
- the proportion of damage to be blockedhorizontalBlockingAngle
- the maximum angle at which attacks will be blocked- Returns:
- the
BlocksAttacksComponent.DamageReduction
instance that was added to this item
-
addDamageReduction
@NotNull BlocksAttacksComponent.DamageReduction addDamageReduction(@NotNull Tag<DamageType> tag, float base, float factor, float horizontalBlockingAngle) Add a new damage reduction to this component, which blocks specific types of attacks.- Parameters:
tag
- the type of attacksbase
- the constant amount of damage to be blockedfactor
- the proportion of damage to be blockedhorizontalBlockingAngle
- the maximum angle at which attacks will be blocked- Returns:
- the
BlocksAttacksComponent.DamageReduction
instance that was added to this item
-
removeDamageReduction
Remove the givenBlocksAttacksComponent.DamageReduction
from this item.- Parameters:
reduction
- the reduction to remove- Returns:
- true if the reduction was removed, false if this component did not contain a matching reduction
-
getItemDamageThreshold
float getItemDamageThreshold()Gets the amount of damage required to be dealt before damage is also applied to the item.- Returns:
- threshold damage amount
-
setItemDamageThreshold
void setItemDamageThreshold(float threshold) Sets the amount of damage required to be dealt before damage is also applied to the item.- Parameters:
threshold
- new threshold damage amount
-
getItemDamageBase
float getItemDamageBase()Gets the constant amount of damage applied to the item if the threshold is reached.- Returns:
- base item damage
-
setItemDamageBase
void setItemDamageBase(float base) Sets the constant amount of damage applied to the item if the threshold is reached.- Parameters:
base
- new base item damage
-
getItemDamageFactor
float getItemDamageFactor()Gets the proportion of damage applied to the item if the threshold is reached.- Returns:
- item damage factor
-
setItemDamageFactor
void setItemDamageFactor(float factor) Sets the proportion of damage applied to the item if the threshold is reached.- Parameters:
factor
- new item damage factor
-
getBlockSound
Gets the sound to play when the item blocks an attack.- Returns:
- the sound
-
setBlockSound
Sets the sound to play when the item blocks an attack.- Parameters:
sound
- sound or null for current default
-
getDisableSound
Gets the sound to play when the item is disabled.- Returns:
- the sound
-
setDisableSound
Sets the sound to play when the item is disabled.- Parameters:
sound
- sound or null for current default
-
getBypassedBy
Gets the type of damage that will bypass blocking by this item.- Returns:
- damage type
-
setBypassedBy
Sets the type of damage that will bypass blocking by this item.- Parameters:
tag
- the tag, or null to clear
-