Class StockEvent
java.lang.Object
net.okocraft.box.api.event.BoxEvent
net.okocraft.box.api.event.stockholder.StockHolderEvent
net.okocraft.box.api.event.stockholder.stock.StockEvent
- Direct Known Subclasses:
StockDecreaseEvent,StockIncreaseEvent,StockSetEvent
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceAn interface that indicates why theStockEventwas called. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedStockEvent(@NotNull StockHolder stockHolder, @NotNull BoxItem item, int amount, @NotNull StockEvent.Cause cause) The constructor ofStockEvent. -
Method Summary
Modifier and TypeMethodDescriptionintGets the current amount of the stock.@NotNull StockEvent.CausegetCause()Gets the cause that indicates why this event was called.@NotNull BoxItemgetItem()Gets the item of the stock.Methods inherited from class net.okocraft.box.api.event.stockholder.StockHolderEvent
getStockHolder, toDebugLog, toString
-
Constructor Details
-
StockEvent
protected StockEvent(@NotNull @NotNull StockHolder stockHolder, @NotNull @NotNull BoxItem item, int amount, @NotNull @NotNull StockEvent.Cause cause) The constructor ofStockEvent.- Parameters:
stockHolder- the stockholder of the eventitem- the item of the stockamount- the current amount of the stockcause- the cause that indicates why this event was called
-
-
Method Details
-
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
Gets the cause that indicates why this event was called.- Returns:
- the cause that indicates why this event was called
- See Also:
-