Package org.bukkit.event.world
Class LootGenerateEvent
java.lang.Object
org.bukkit.event.Event
org.bukkit.event.world.WorldEvent
org.bukkit.event.world.LootGenerateEvent
- All Implemented Interfaces:
- Cancellable
Called when a 
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).- 
Nested Class SummaryNested classes/interfaces inherited from class org.bukkit.event.EventEvent.Result
- 
Constructor SummaryConstructorsConstructorDescriptionLootGenerateEvent(World world, Entity entity, InventoryHolder inventoryHolder, LootTable lootTable, LootContext lootContext, List<ItemStack> items, boolean plugin) 
- 
Method SummaryModifier and TypeMethodDescriptionGet the entity used as context for loot generation (if applicable).static HandlerListGet the inventory holder in which the loot was generated.getLoot()Get a mutable list of all loot to be generated.Get the loot context used to provide context to the loot table's loot generation.Get the loot table used to generate loot.booleanGets the cancellation state of this event.booleanisPlugin()Check whether or not this event was called as a result of a plugin invokingLootTable.fillInventory(org.bukkit.inventory.Inventory, java.util.Random, LootContext).voidsetCancelled(boolean cancel) Sets the cancellation state of this event.voidsetLoot(Collection<ItemStack> loot) Set the loot to be generated.Methods inherited from class org.bukkit.event.world.WorldEventgetWorldMethods inherited from class org.bukkit.event.EventgetEventName, isAsynchronous
- 
Constructor Details- 
LootGenerateEvent
 
- 
- 
Method Details- 
getEntityGet the entity used as context for loot generation (if applicable). For inventories where entities are not required to generate loot, such as hoppers, null will be returned. This is a convenience method forgetLootContext().getLootedEntity().- Returns:
- the entity
 
- 
getInventoryHolderGet the inventory holder in which the loot was generated. If the loot was generated as a result of the block being broken, the inventory holder will be null as this event is called post block break.- Returns:
- the inventory holder
 
- 
getLootTableGet the loot table used to generate loot.- Returns:
- the loot table
 
- 
getLootContextGet the loot context used to provide context to the loot table's loot generation.- Returns:
- the loot context
 
- 
setLootSet the loot to be generated. Null items will be treated as air. Note: the set collection is not the one which will be returned bygetLoot().- Parameters:
- loot- the loot to generate, null to clear all loot
 
- 
getLootGet a mutable list of all loot to be generated. Any items added or removed from the returned list will be reflected in the loot generation. Null items will be treated as air.- Returns:
- the loot to generate
 
- 
isPluginpublic boolean isPlugin()Check whether or not this event was called as a result of a plugin invokingLootTable.fillInventory(org.bukkit.inventory.Inventory, java.util.Random, LootContext).- Returns:
- true if plugin caused, false otherwise
 
- 
setCancelledpublic void setCancelled(boolean cancel) Description copied from interface:CancellableSets 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:
- setCancelledin interface- Cancellable
- Parameters:
- cancel- true if you wish to cancel this event
 
- 
isCancelledpublic boolean isCancelled()Description copied from interface:CancellableGets 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:
- isCancelledin interface- Cancellable
- Returns:
- true if this event is cancelled
 
- 
getHandlers- Specified by:
- getHandlersin class- Event
 
- 
getHandlerList
 
-