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 AbstractInventory is closed by a player.
  • Constructor Details

    • InventoryCloseEvent

      public InventoryCloseEvent(@NotNull @NotNull AbstractInventory 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

      @NotNull public @NotNull AbstractInventory getInventory()
      Description copied from interface: InventoryEvent
      Gets the inventory that was clicked.
      Specified by:
      getInventory in interface InventoryEvent