Package valorless.havenbags.events
Class BagOpenEvent
java.lang.Object
org.bukkit.event.Event
valorless.havenbags.events.BagOpenEvent
public class BagOpenEvent
extends org.bukkit.event.Event
Called when a player opens a HavenBag inventory.
This event provides access to the Player
, the Inventory
that was opened,
the bag ItemStack
, and the corresponding Data
object storing bag metadata.
Use this event to handle initialization, logging, or custom logic when a bag is opened.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bukkit.event.Event
org.bukkit.event.Event.Result
-
Constructor Summary
ConstructorsConstructorDescriptionBagOpenEvent
(org.bukkit.inventory.Inventory inventory, org.bukkit.entity.Player player, org.bukkit.inventory.ItemStack bagItem, Data bagData) Constructs a new BagOpenEvent. -
Method Summary
Modifier and TypeMethodDescriptionGets theData
associated with the bag.org.bukkit.inventory.ItemStack
Gets the ItemStack representing the bag.static org.bukkit.event.HandlerList
Required boilerplate: returns the static HandlerList for this event type.org.bukkit.event.HandlerList
Required boilerplate: returns the list of handlers listening to this event.org.bukkit.inventory.Inventory
Gets the bag inventory that was opened.org.bukkit.entity.Player
Gets the player who opened the bag.Methods inherited from class org.bukkit.event.Event
getEventName, isAsynchronous
-
Constructor Details
-
BagOpenEvent
public BagOpenEvent(org.bukkit.inventory.Inventory inventory, org.bukkit.entity.Player player, org.bukkit.inventory.ItemStack bagItem, Data bagData) Constructs a new BagOpenEvent.- Parameters:
inventory
- The bag's inventory that was openedplayer
- The player who opened the bagbagItem
- The ItemStack representing the bagbagData
- The bag's associatedData
-
-
Method Details
-
getHandlers
public org.bukkit.event.HandlerList getHandlers()Required boilerplate: returns the list of handlers listening to this event.- Specified by:
getHandlers
in classorg.bukkit.event.Event
- Returns:
- HandlerList for BagOpenEvent
-
getHandlerList
public static org.bukkit.event.HandlerList getHandlerList()Required boilerplate: returns the static HandlerList for this event type.- Returns:
- HandlerList for BagOpenEvent
-
getInventory
public org.bukkit.inventory.Inventory getInventory()Gets the bag inventory that was opened.- Returns:
- The opened inventory
-
getPlayer
public org.bukkit.entity.Player getPlayer()Gets the player who opened the bag.- Returns:
- The player who opened the inventory
-
getBagItem
public org.bukkit.inventory.ItemStack getBagItem()Gets the ItemStack representing the bag.- Returns:
- The bag ItemStack
-
getBagData
Gets theData
associated with the bag.- Returns:
- The bag data
-