Class InventoryOpenEvent

All Implemented Interfaces:
Cancellable

public class InventoryOpenEvent extends InventoryEvent implements Cancellable
Called when a player opens an inventory
Since:
1.1.0
  • 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
      Since:
      1.1.0
    • titleOverride

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

      public void titleOverride(@Nullable @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 and nautilus inventories are a special case where setting this will have no effect. These inventory titles are set by the entity's display name.

      Parameters:
      titleOverride - the title override or null
      Since:
      1.20.1
    • 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 this event is cancelled, the inventory screen will not show.

      Specified by:
      isCancelled in interface Cancellable
      Returns:
      true if this event is cancelled
      Since:
      1.1.0
    • 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 this 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
      Since:
      1.1.0
    • getHandlers

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

      @NotNull public static @NotNull HandlerList getHandlerList()
      Since:
      1.1.0