Class ResurrectEvent

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

public class ResurrectEvent extends Object implements org.bukkit.event.Listener
Bukkit listener that enables RareSpawns "totem" items to resurrect entities.

Behavior:

  • Players: Scans the entire inventory for a rare item whose ItemData.totem flag is true. If ItemData.totemHeld is true, the item must be held in the main- or off-hand. When a valid item is found, the event is allowed to proceed (via setCancelled(false)), an optional sound (ItemData.totemSound) is played at the player's location, and exactly one item is consumed.
  • Non-player entities: Checks the entity's equipment (off-hand then main-hand then armor) for a rare totem item and applies the same allow/play/consume behavior.
Only one matching item is consumed per resurrection event. Register this listener by calling init() during plugin enable.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    Registers this listener with Bukkit's PluginManager.
    void
    onEntityResurrect(org.bukkit.event.entity.EntityResurrectEvent event)
    Handles EntityResurrectEvent to allow rare items configured as totems to trigger resurrection.

    Methods inherited from class java.lang.Object

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

    • ResurrectEvent

      public ResurrectEvent()
  • Method Details

    • init

      public static void init()
      Registers this listener with Bukkit's PluginManager. Call from your plugin's onEnable().
    • onEntityResurrect

      public void onEntityResurrect(org.bukkit.event.entity.EntityResurrectEvent event)
      Handles EntityResurrectEvent to allow rare items configured as totems to trigger resurrection.

      This method ensures the event is not cancelled when a valid rare totem is present, optionally plays a configured sound, and consumes one unit of the totem item. For players, the entire inventory is scanned; when totemHeld is required, only main/off-hand items qualify. For non-players, only equipments are checked.

      Parameters:
      event - the resurrection event fired when an entity would resurrect (e.g., Totem of Undying)