Direct Known Subclasses:
StockDecreaseEvent, StockIncreaseEvent, StockSetEvent

public class StockEvent extends StockHolderEvent
A StockHolderEvent called when the stock of the StockHolder is modified.

You need to be very careful not to call methods that cause changes to a StockHolder in the event, as this may result in an infinite loop.

  • Constructor Details

    • StockEvent

      protected StockEvent(@NotNull @NotNull StockHolder stockHolder, @NotNull @NotNull BoxItem item, int amount, @NotNull @NotNull StockEvent.Cause cause)
      The constructor of StockEvent.
      Parameters:
      stockHolder - the stockholder of the event
      item - the item of the stock
      amount - the current amount of the stock
      cause - the cause that indicates why this event was called
  • Method Details

    • getItem

      @NotNull public @NotNull BoxItem getItem()
      Gets the item of the stock.
      Returns:
      the item of the stock
    • getAmount

      public int getAmount()
      Gets the current amount of the stock.
      Returns:
      the current amount of the stock
    • getCause

      @NotNull public @NotNull StockEvent.Cause getCause()
      Gets the cause that indicates why this event was called.
      Returns:
      the cause that indicates why this event was called
      See Also: