Class InventoryOpenEvent

All Implemented Interfaces:
Cancellable

public class InventoryOpenEvent extends InventoryEvent implements Cancellable
Called when a player opens an inventory
  • Constructor Details

  • Method Details

    • getPlayer

      @NotNull public final @NotNull HumanEntity getPlayer()
      Returns the player involved in this event
      Returns:
      Player who is involved in this event
    • isCancelled

      public boolean isCancelled()
      Gets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins.

      If an inventory open event is cancelled, the inventory screen will not show.

      Specified by:
      isCancelled in interface Cancellable
      Returns:
      true if this event is cancelled
    • setCancelled

      public void setCancelled(boolean cancel)
      Sets the cancellation state of this event. A cancelled event will not be executed in the server, but will still pass to other plugins.

      If an inventory open event is cancelled, the inventory screen will not show.

      Specified by:
      setCancelled in interface Cancellable
      Parameters:
      cancel - true if you wish to cancel this event
    • titleOverride

      public @Nullable Component titleOverride()
      Gets the title override set by another event or null if not set.
      Returns:
      the title override or null
    • titleOverride

      public void titleOverride(@Nullable Component titleOverride)
      Sets the title override or clears the override.

      This is only the title sent to the client in the open packet, this doesn't change the title returned by InventoryView.title(), hence "override".

      NOTE: Horse inventories are a special case where setting this will have no effect. Horse inventory titles are set by the horse display name.

      Parameters:
      titleOverride - the title override or null
    • getHandlers

      @NotNull public @NotNull HandlerList getHandlers()
      Overrides:
      getHandlers in class InventoryEvent
    • getHandlerList

      @NotNull public static @NotNull HandlerList getHandlerList()