Package org.bukkit.event.block
Class BlockDispenseLootEvent
java.lang.Object
org.bukkit.event.Event
org.bukkit.event.block.BlockEvent
org.bukkit.event.block.BlockDispenseLootEvent
- All Implemented Interfaces:
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.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
Event.Result
-
Field Summary
Fields inherited from class org.bukkit.event.block.BlockEvent
block
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the loot that will be dispensed.static @NotNull HandlerList
Gets the loot table used to generate the initial loot to dispense.Gets the player associated with this event.boolean
Gets the cancellation state of this event.void
setCancelled
(boolean cancelled) Sets the cancellation state of this event.void
setDispensedLoot
(@Nullable List<ItemStack> dispensedLoot) Sets the loot that will be dispensed.Methods inherited from class org.bukkit.event.block.BlockEvent
getBlock
Methods inherited from class org.bukkit.event.Event
callEvent, getEventName, isAsynchronous
-
Constructor Details
-
BlockDispenseLootEvent
-
-
Method Details
-
getDispensedLoot
Gets the loot that will be dispensed.- Returns:
- the loot that will be dispensed
-
setDispensedLoot
Sets the loot that will be dispensed.- Parameters:
dispensedLoot
- new loot to dispense
-
getLootTable
Gets the loot table used to generate the initial loot to dispense.- Returns:
- the loot table used to generate the initial loot to dispense
-
getPlayer
Gets the player associated with this event.
Warning: Some event instances like aTrialSpawner
dispensing its reward loot may not have a player associated with them and will returnnull
.- 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 interfaceCancellable
- 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 interfaceCancellable
- Parameters:
cancelled
-true
if you wish to cancel this event
-
getHandlers
- Specified by:
getHandlers
in classEvent
-
getHandlerList
-