Class DamageEvent

java.lang.Object
valorless.rarespawns.events.DamageEvent
All Implemented Interfaces:
org.bukkit.event.Listener

public class DamageEvent extends Object implements org.bukkit.event.Listener
Handles damage-related events for entities marked as rare. Responsibilities: - Update rare entity boss bars on damage. - Apply configured damage immunities (generic and by-entity causes). - Provide feedback when projectiles are blocked and cancel specific sources like fireworks.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    Registers this listener with the Bukkit plugin manager.
    void
    onEntityDamage(org.bukkit.event.entity.EntityDamageEvent event)
    Applies generic damage handling for rare entities: updates boss bar health and cancels damage if the cause is listed as immune in the entity's config.
    void
    onEntityDamageByEntity(org.bukkit.event.entity.EntityDamageByEntityEvent event)
    Applies damage handling when another entity is the damager.
    void
    onFireworkDamage(org.bukkit.event.entity.EntityDamageByEntityEvent event)
    Cancels damage to rare entities caused by fireworks explosions.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DamageEvent

      public DamageEvent()
  • Method Details

    • init

      public static void init()
      Registers this listener with the Bukkit plugin manager.
    • onEntityDamage

      public void onEntityDamage(org.bukkit.event.entity.EntityDamageEvent event)
      Applies generic damage handling for rare entities: updates boss bar health and cancels damage if the cause is listed as immune in the entity's config.
      Parameters:
      event - entity damage event (non-specific attacker)
    • onEntityDamageByEntity

      public void onEntityDamageByEntity(org.bukkit.event.entity.EntityDamageByEntityEvent event)
      Applies damage handling when another entity is the damager. Performs the same immunity checks and additionally provides feedback for blocked projectiles (e.g., arrow deflection effects).
      Parameters:
      event - damage-by-entity event
    • onFireworkDamage

      public void onFireworkDamage(org.bukkit.event.entity.EntityDamageByEntityEvent event)
      Cancels damage to rare entities caused by fireworks explosions.
      Parameters:
      event - damage-by-entity event to evaluate for fireworks explosions