public class LootGenerateEvent extends WorldEvent implements Cancellable
LootTable
is generated in the world for an
InventoryHolder
.
This event is NOT currently called when an entity's loot table has been
generated (use EntityDeathEvent.getDrops()
, but WILL be called by
plugins invoking
LootTable.fillInventory(org.bukkit.inventory.Inventory, java.util.Random, LootContext)
.Event.Result
Constructor and Description |
---|
LootGenerateEvent(World world,
Entity entity,
InventoryHolder inventoryHolder,
LootTable lootTable,
LootContext lootContext,
List<ItemStack> items,
boolean plugin) |
Modifier and Type | Method and Description |
---|---|
Entity |
getEntity()
Get the entity used as context for loot generation (if applicable).
|
static HandlerList |
getHandlerList() |
HandlerList |
getHandlers() |
InventoryHolder |
getInventoryHolder()
Get the inventory holder in which the loot was generated.
|
List<ItemStack> |
getLoot()
Get a mutable list of all loot to be generated.
|
LootContext |
getLootContext()
Get the loot context used to provide context to the loot table's loot
generation.
|
LootTable |
getLootTable()
Get the loot table used to generate loot.
|
boolean |
isCancelled()
Gets the cancellation state of this event.
|
boolean |
isPlugin()
Check whether or not this event was called as a result of a plugin
invoking
LootTable.fillInventory(org.bukkit.inventory.Inventory, java.util.Random, LootContext) . |
void |
setCancelled(boolean cancel)
Sets the cancellation state of this event.
|
void |
setLoot(Collection<ItemStack> loot)
Set the loot to be generated.
|
getWorld
getEventName, isAsynchronous
@Nullable public Entity getEntity()
getLootContext().getLootedEntity()
.@Nullable public InventoryHolder getInventoryHolder()
@NotNull public LootTable getLootTable()
@NotNull public LootContext getLootContext()
public void setLoot(@Nullable Collection<ItemStack> loot)
getLoot()
.loot
- the loot to generate, null to clear all loot@NotNull public List<ItemStack> getLoot()
public boolean isPlugin()
LootTable.fillInventory(org.bukkit.inventory.Inventory, java.util.Random, LootContext)
.public void setCancelled(boolean cancel)
Cancellable
setCancelled
in interface Cancellable
cancel
- true if you wish to cancel this eventpublic boolean isCancelled()
Cancellable
isCancelled
in interface Cancellable
@NotNull public HandlerList getHandlers()
getHandlers
in class Event
@NotNull public static HandlerList getHandlerList()
Copyright © 2021. All rights reserved.