Class LootContainerFillEvent

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.LootContainerFillEvent
All Implemented Interfaces:
org.bukkit.event.Cancellable

public final class LootContainerFillEvent extends ZentrixGameEvent implements org.bukkit.event.Cancellable
Called before Zentrix generates lazy loot into a container: when a participant first opens it, when they open it again after a refill, or when it is destroyed before being opened and its loot drops instead.

The container has already been claimed for this refill cycle when this fires, so cancelling leaves it exactly as it is - with whatever it holds now, not cleared even for a replacing refill - and it is not generated again until the next refill. Use LootContainerFilledEvent to adjust what was generated instead.

A container that holds slots of two pools, such as a double chest on the Cornucopia's edge, fires once per pool. Eager Cornucopia population at match start does not fire this event.

Main thread; only fired while a listener is registered.

Since:
1.8.0
  • Constructor Details

    • LootContainerFillEvent

      public LootContainerFillEvent(@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, boolean replacing, boolean destroyed)
  • Method Details

    • getPool

      @NotNull public @NotNull LootPool getPool()
      The pool the loot comes 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 being generated: 0 for the first fill, then one more per refill.
    • isReplacing

      public boolean isReplacing()
      Whether this is a replacing refill, which clears the container's loot slots first.
    • isDestroyed

      public boolean isDestroyed()
      Whether the container was destroyed, so the loot will drop at its location.
    • isCancelled

      public boolean isCancelled()
      Specified by:
      isCancelled in interface org.bukkit.event.Cancellable
    • setCancelled

      public void setCancelled(boolean cancelled)
      Specified by:
      setCancelled in interface org.bukkit.event.Cancellable
    • 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()