Class LootContainerFilledEvent

java.lang.Object
org.bukkit.event.Event
dev.itsharshxd.zentrix.api.events.ZentrixEvent
dev.itsharshxd.zentrix.api.events.ZentrixGameEvent
dev.itsharshxd.zentrix.api.events.loot.LootContainerFilledEvent

public final class LootContainerFilledEvent extends ZentrixGameEvent
Called after Zentrix generated lazy loot for a container, once per pool.

For an opened container the loot is already in getInventory(), which listeners may edit directly - add, remove or replace items - before the player sees it. For a destroyed container nothing has dropped yet: getDrops() is the mutable list of items about to drop at its location. Appearance counters and the generation result are final either way; editing items does not give back or consume appearances of the pool's entries.

Main thread; only fired while a listener is registered.

Since:
1.8.0
  • Constructor Details

    • LootContainerFilledEvent

      public LootContainerFilledEvent(@NotNull @NotNull ZentrixGame game, @NotNull @NotNull LootPool pool, @NotNull @NotNull LootContainerType containerType, @NotNull @NotNull org.bukkit.Location location, @Nullable @Nullable org.bukkit.entity.Player player, long cycle, @NotNull @NotNull LootGenerationResult result, @Nullable @Nullable org.bukkit.inventory.Inventory inventory, @Nullable @Nullable List<org.bukkit.inventory.ItemStack> drops)
  • Method Details

    • getPool

      @NotNull public @NotNull LootPool getPool()
      The pool the loot came from.
    • getContainerType

      @NotNull public @NotNull LootContainerType getContainerType()
      The kind of container.
    • getLocation

      @NotNull public @NotNull org.bukkit.Location getLocation()
      Where the container is; a copy.
    • getPlayer

      @NotNull public @NotNull Optional<org.bukkit.entity.Player> getPlayer()
      The participant who opened it; empty when it was destroyed.
    • getCycle

      public long getCycle()
      The refill cycle generated: 0 for the first fill, then one more per refill.
    • getResult

      @NotNull public @NotNull LootGenerationResult getResult()
      What was generated: placements, appearances that found no room, failures.
    • isDestroyed

      public boolean isDestroyed()
      Whether the container was destroyed, so the loot drops rather than staying inside.
    • getInventory

      @NotNull public @NotNull Optional<org.bukkit.inventory.Inventory> getInventory()
      The container's live inventory holding the loot; empty for a destroyed container.
    • getDrops

      @NotNull public @NotNull List<org.bukkit.inventory.ItemStack> getDrops()
      The items about to drop from a destroyed container, which listeners may change; an empty, unused list for an opened container.
    • getHandlers

      @NotNull public @NotNull org.bukkit.event.HandlerList getHandlers()
      Description copied from class: ZentrixGameEvent
      Gets the handler list for this event.
      Overrides:
      getHandlers in class ZentrixGameEvent
      Returns:
      The handler list
    • getHandlerList

      @NotNull public static @NotNull org.bukkit.event.HandlerList getHandlerList()