Class InventoryCloseEvent

java.lang.Object
net.minestom.server.event.inventory.InventoryCloseEvent
All Implemented Interfaces:
Event, EntityEvent, EntityInstanceEvent, InstanceEvent, InventoryEvent, PlayerEvent, PlayerInstanceEvent

public class InventoryCloseEvent extends Object implements InventoryEvent, PlayerInstanceEvent
Called when an Inventory is closed by a player.
  • Constructor Details

    • InventoryCloseEvent

      public InventoryCloseEvent(@Nullable @Nullable Inventory inventory, @NotNull @NotNull Player player)
  • Method Details

    • getPlayer

      @NotNull public @NotNull Player getPlayer()
      Gets the player who closed the inventory.
      Specified by:
      getPlayer in interface PlayerEvent
      Returns:
      the player who closed the inventory
    • getNewInventory

      @Nullable public @Nullable Inventory getNewInventory()
      Gets the new inventory to open.
      Returns:
      the new inventory to open, null if there isn't any
    • setNewInventory

      public void setNewInventory(@Nullable @Nullable Inventory newInventory)
      Can be used to open a new inventory after closing the previous one.
      Parameters:
      newInventory - the inventory to open, null to do not open any
    • getInventory

      @Nullable public @Nullable Inventory getInventory()
      Description copied from interface: InventoryEvent
      Gets the inventory.
      Specified by:
      getInventory in interface InventoryEvent
      Returns:
      the inventory, null if this is a player's inventory