Class PlayerDeathInventoryDropEvent

java.lang.Object
org.bukkit.event.Event
org.bukkit.event.player.PlayerEvent
de.marcely.bedwars.api.event.player.PlayerDeathInventoryDropEvent
All Implemented Interfaces:
ArenaEvent

public class PlayerDeathInventoryDropEvent extends PlayerEvent implements ArenaEvent
Gets called whenever MBedwars is handling the drops of a players' death.

The determination of what shall be dropped works by a queue that's effectively only a List under the hood. You're able to modify the queue within this event. After the execution of this event MBedwars will execute each PlayerDeathInventoryDropEvent.Handler inside the queue which runs in an order from top to bottom. Updated states get passed to the PlayerDeathInventoryDropEvent.Handler below. MBedwars delivers a few default Handlers out of the box, but it depends on the configuration of the user which of them get added to the queue.

  • Constructor Details

    • PlayerDeathInventoryDropEvent

      public PlayerDeathInventoryDropEvent(Player player, Arena arena)
  • Method Details

    • getHandlerQueue

      public List<PlayerDeathInventoryDropEvent.Handler> getHandlerQueue()
      Returns the queue invoked in this event.

      Entries at index 0 are on top, those at Collection.size()-1 are at bottom. It's safe to modify this List (add/remove entries).

      Returns:
      The queue involved in this event
    • addHandlerToTop

      public boolean addHandlerToTop(PlayerDeathInventoryDropEvent.Handler handler)
      Adds a new Handler to the top of the queue.

      This Handler might get executed first in the queue and might even contain all original states. Executing this again will put the existing ones below the new one.

      Parameters:
      handler - Handles what shall happen with the drops
      Returns:
      false if the handler is already included
    • addHandlerToBottom

      public boolean addHandlerToBottom(PlayerDeathInventoryDropEvent.Handler handler)
      Adds a new Handler to the bottom of the queue.

      This Handler might get executed as last in the queue whereby it probably won't have the original states. Executing this again will put the existing ones above the new one.

      Parameters:
      handler - Handles what shall happen with the drops
      Returns:
      false if the handler is already included
    • removeHandler

      public boolean removeHandler(PlayerDeathInventoryDropEvent.Handler handler)
      Tries to remove a Handler that has been added before
      Parameters:
      handler - The Handler instance that shall be removed
      Returns:
      true if this queue contained the specified element
    • getHandlers

      public HandlerList getHandlers()
      Specified by:
      getHandlers in class Event
    • getHandlerList

      public static HandlerList getHandlerList()