Cancellable
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 | Description |
---|---|
LootGenerateEvent(@NotNull World world,
@Nullable Entity entity,
@Nullable InventoryHolder inventoryHolder,
@NotNull LootTable lootTable,
@NotNull LootContext lootContext,
@NotNull List<ItemStack> items,
boolean plugin) |
Modifier and Type | Method | Description |
---|---|---|
@Nullable Entity |
getEntity() |
Get the entity used as context for loot generation (if applicable).
|
static @NotNull HandlerList |
getHandlerList() |
|
@NotNull HandlerList |
getHandlers() |
|
@Nullable InventoryHolder |
getInventoryHolder() |
Get the inventory holder in which the loot was generated.
|
@NotNull List<ItemStack> |
getLoot() |
Get a mutable list of all loot to be generated.
|
@NotNull LootContext |
getLootContext() |
Get the loot context used to provide context to the loot table's loot
generation.
|
@NotNull 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(@Nullable Collection<ItemStack> loot) |
Set the loot to be generated.
|
getEventName, isAsynchronous
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getWorld
public LootGenerateEvent(@NotNull @NotNull World world, @Nullable @Nullable Entity entity, @Nullable @Nullable InventoryHolder inventoryHolder, @NotNull @NotNull LootTable lootTable, @NotNull @NotNull LootContext lootContext, @NotNull @NotNull List<ItemStack> items, boolean plugin)
@Nullable public @Nullable Entity getEntity()
getLootContext().getLootedEntity()
.@Nullable public @Nullable InventoryHolder getInventoryHolder()
@NotNull public @NotNull LootTable getLootTable()
@NotNull public @NotNull LootContext getLootContext()
public void setLoot(@Nullable @Nullable Collection<ItemStack> loot)
getLoot()
.loot
- the loot to generate, null to clear all loot@NotNull public @NotNull 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 @NotNull HandlerList getHandlers()
getHandlers
in class Event
@NotNull public static @NotNull HandlerList getHandlerList()
Copyright © 2020. All rights reserved.