Package valorless.rarespawns.events
Class IFramesEvent
java.lang.Object
valorless.rarespawns.events.IFramesEvent
- All Implemented Interfaces:
org.bukkit.event.Listener
Listener to set custom invulnerability frames (iframes) for rare entities.
When a rare entity is damaged, this listener checks if it has a configured iframes value and applies it to the entity, overriding the default invulnerability duration. This allows for fine-tuning of combat behavior for rare entities.
Lifecycle
- Registered once via
init()during plugin enable. - No persistent state; purely event-driven.
Thread Safety
Bukkit events run on the main server thread; no external synchronization is required.Failure / Edge Cases
- If the entity is not a rare spawn or has no iframes configured, no action is taken.
- If the frames value is zero or negative, default Bukkit behavior applies.
Usage
Define an iframes value in theEntityData for a rare entity. When that entity
takes damage, it will use the specified iframes duration instead of the default.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidinit()Registers this listener with the Bukkit plugin manager.voidonEntityByEntityDamage(org.bukkit.event.entity.EntityDamageByEntityEvent event) Event handler for EntityDamageByEntityEvent to apply custom iframes to rare entities.
-
Constructor Details
-
IFramesEvent
public IFramesEvent()
-
-
Method Details
-
init
public static void init()Registers this listener with the Bukkit plugin manager. -
onEntityByEntityDamage
public void onEntityByEntityDamage(org.bukkit.event.entity.EntityDamageByEntityEvent event) Event handler for EntityDamageByEntityEvent to apply custom iframes to rare entities.When a rare entity is damaged, this method checks if it has a configured iframes value in its EntityData. If so, it sets the entity's no damage ticks to that value, overriding the default invulnerability duration.
- Parameters:
event- the entity damage by entity event
-