Class DeathEvent

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

public class DeathEvent extends Object implements org.bukkit.event.Listener
Listener for handling rare entity deaths.

Performs cleanup of runnables and boss bars, manages loot drops based on configured drop tables, dispatches a custom RareDeathEvent, and optionally notifies nearby players with messages and sounds. Also includes helper methods to check command-kill and minion status, and to manually drop loot.

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    CommandKilled(org.bukkit.entity.LivingEntity rare)
    Determines whether the given rare entity was killed via a command.
    static boolean
    dropLoot(org.bukkit.entity.LivingEntity rare)
    Drops loot for a rare entity using its configured drop table at its location.
    static void
    Registers this listener with the server's plugin manager.
    static boolean
    isMinion(org.bukkit.entity.LivingEntity entity)
    Checks whether the entity is marked as a minion of a rare entity.
    void
    onEntityDeath(org.bukkit.event.entity.EntityDeathEvent event)
    Handles the Bukkit EntityDeathEvent for tracked rare entities.

    Methods inherited from class java.lang.Object

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

    • DeathEvent

      public DeathEvent()
  • Method Details

    • init

      public static void init()
      Registers this listener with the server's plugin manager.
    • onEntityDeath

      public void onEntityDeath(org.bukkit.event.entity.EntityDeathEvent event)
      Handles the Bukkit EntityDeathEvent for tracked rare entities.
      • Cancels minion drops
      • Cleans up runnables, boss bars, and internal caches
      • Generates and applies drops using the entity's drop table
      • Dispatches RareDeathEvent and optionally messages nearby players
      Parameters:
      event - the entity death event
    • CommandKilled

      public static boolean CommandKilled(org.bukkit.entity.LivingEntity rare)
      Determines whether the given rare entity was killed via a command.
      Parameters:
      rare - the entity to inspect
      Returns:
      true if the 'RareEntity-Kill' tag is present
    • isMinion

      public static boolean isMinion(org.bukkit.entity.LivingEntity entity)
      Checks whether the entity is marked as a minion of a rare entity.
      Parameters:
      entity - the entity to inspect
      Returns:
      true if the 'RareEntity-Minion' tag is present
    • dropLoot

      public static boolean dropLoot(org.bukkit.entity.LivingEntity rare)
      Drops loot for a rare entity using its configured drop table at its location. Does nothing special if the entity is not rare.
      Parameters:
      rare - the entity to drop loot for
      Returns:
      true when the method completes