Package valorless.rarespawns.events
Class DeathEvent
java.lang.Object
valorless.rarespawns.events.DeathEvent
- All Implemented Interfaces:
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 -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanCommandKilled(org.bukkit.entity.LivingEntity rare) Determines whether the given rare entity was killed via a command.static booleandropLoot(org.bukkit.entity.LivingEntity rare) Drops loot for a rare entity using its configured drop table at its location.static voidinit()Registers this listener with the server's plugin manager.static booleanisMinion(org.bukkit.entity.LivingEntity entity) Checks whether the entity is marked as a minion of a rare entity.voidonEntityDeath(org.bukkit.event.entity.EntityDeathEvent event) Handles the Bukkit EntityDeathEvent for tracked rare entities.
-
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
-