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
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
org.bukkit.event.Event.Result -
Constructor Summary
ConstructorsConstructorDescriptionLootContainerFillEvent(@NotNull ZentrixGame game, @NotNull LootPool pool, @NotNull LootContainerType containerType, @NotNull org.bukkit.Location location, @Nullable org.bukkit.entity.Player player, long cycle, boolean replacing, boolean destroyed) -
Method Summary
Modifier and TypeMethodDescription@NotNull LootContainerTypeThe kind of container.longgetCycle()The refill cycle being generated: 0 for the first fill, then one more per refill.static @NotNull org.bukkit.event.HandlerList@NotNull org.bukkit.event.HandlerListGets the handler list for this event.@NotNull org.bukkit.LocationWhere the container is; a copy.@NotNull Optional<org.bukkit.entity.Player> The participant who opened it; empty when it was destroyed.@NotNull LootPoolgetPool()The pool the loot comes from.booleanbooleanWhether the container was destroyed, so the loot will drop at its location.booleanWhether this is a replacing refill, which clears the container's loot slots first.voidsetCancelled(boolean cancelled) Methods inherited from class dev.itsharshxd.zentrix.api.events.ZentrixGameEvent
getArenaName, getGame, getGameId, getGameState, getGameTypeName, getPlayerCount, getRuntimeId, getSourceArenaNameMethods inherited from class org.bukkit.event.Event
callEvent, getEventName, isAsynchronous
-
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
The pool the loot comes from. -
getContainerType
The kind of container. -
getLocation
@NotNull public @NotNull org.bukkit.Location getLocation()Where the container is; a copy. -
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:
isCancelledin interfaceorg.bukkit.event.Cancellable
-
setCancelled
public void setCancelled(boolean cancelled) - Specified by:
setCancelledin interfaceorg.bukkit.event.Cancellable
-
getHandlers
@NotNull public @NotNull org.bukkit.event.HandlerList getHandlers()Description copied from class:ZentrixGameEventGets the handler list for this event.- Overrides:
getHandlersin classZentrixGameEvent- Returns:
- The handler list
-
getHandlerList
@NotNull public static @NotNull org.bukkit.event.HandlerList getHandlerList()
-