Class BlockDispenseLootEvent

java.lang.Object
org.bukkit.event.Event
org.bukkit.event.block.BlockEvent
org.bukkit.event.block.BlockDispenseLootEvent
All Implemented Interfaces:
Cancellable

@Experimental public class BlockDispenseLootEvent extends BlockEvent implements Cancellable
Called when a block dispenses loot from its designated LootTable. This is not to be confused with events like BlockDispenseEvent which fires when a singular item is dispensed from its inventory container.

Example: A player unlocks a trial chamber vault and the vault block dispenses its loot.
  • Constructor Details

    • BlockDispenseLootEvent

      public BlockDispenseLootEvent(@Nullable Player player, @NotNull Block theBlock, @NotNull List<ItemStack> dispensedLoot)
  • Method Details

    • getDispensedLoot

      @NotNull public List<ItemStack> getDispensedLoot()
      Gets the loot that will be dispensed.
      Returns:
      the loot that will be dispensed
    • setDispensedLoot

      public void setDispensedLoot(@Nullable List<ItemStack> dispensedLoot)
      Sets the loot that will be dispensed.
      Parameters:
      dispensedLoot - new loot to dispense
    • getPlayer

      @Nullable public Player getPlayer()
      Gets the player associated with this event.
      Warning: Some event instances like a TrialSpawner dispensing its reward loot may not have a player associated with them and will return null.
      Returns:
      the player who unlocked the vault
    • isCancelled

      public boolean isCancelled()
      Description copied from interface: Cancellable
      Gets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins
      Specified by:
      isCancelled in interface Cancellable
      Returns:
      true if this event is cancelled
    • setCancelled

      public void setCancelled(boolean cancelled)
      Description copied from interface: Cancellable
      Sets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins.
      Specified by:
      setCancelled in interface Cancellable
      Parameters:
      cancelled - true if you wish to cancel this event
    • getHandlers

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

      @NotNull public static HandlerList getHandlerList()