Package net.okocraft.box.api.model.stock
Interface StockEventCaller
public interface StockEventCaller
An interface that is used for calling
StockEvents from StockHolder.-
Method Summary
Modifier and TypeMethodDescriptionvoidcallDecreaseEvent(@NotNull StockHolder stockHolder, @NotNull BoxItem item, int decrements, int currentAmount, StockEvent.Cause cause) CallsStockDecreaseEvent.voidcallIncreaseEvent(@NotNull StockHolder stockHolder, @NotNull BoxItem item, int increments, int currentAmount, StockEvent.Cause cause) CallsStockIncreaseEvent.voidcallOverflowEvent(@NotNull StockHolder stockHolder, @NotNull BoxItem item, int increments, int excess, StockEvent.Cause cause) CallsStockOverflowEvent.voidcallResetEvent(@NotNull StockHolder stockHolder, @NotNull Collection<StockData> stockDataBeforeReset) CallsStockHolderResetEvent.voidcallSetEvent(@NotNull StockHolder stockHolder, @NotNull BoxItem item, int amount, int previousAmount, StockEvent.Cause cause) CallsStockSetEvent.static @NotNull StockEventCallercreateDefault(@NotNull EventCaller<BoxEvent> eventCaller) Creates a default implementation ofStockEventCaller.
-
Method Details
-
createDefault
@Contract(value="_ -> new", pure=true) @NotNull static @NotNull StockEventCaller createDefault(@NotNull @NotNull EventCaller<BoxEvent> eventCaller) Creates a default implementation ofStockEventCaller.- Parameters:
eventCaller- aEventCallerto callStockEvents- Returns:
- a new
StockEventCaller
-
callSetEvent
void callSetEvent(@NotNull @NotNull StockHolder stockHolder, @NotNull @NotNull BoxItem item, int amount, int previousAmount, @NotNull StockEvent.Cause cause) CallsStockSetEvent.- Parameters:
stockHolder- the sourceStockHolderitem- the item that has set the amount of stockamount- the amount of stockpreviousAmount- the amount of stock before setcause- theStockEvent.Causethat is passed toStockHolder.setAmount(BoxItem, int, StockEvent.Cause)
-
callIncreaseEvent
void callIncreaseEvent(@NotNull @NotNull StockHolder stockHolder, @NotNull @NotNull BoxItem item, int increments, int currentAmount, @NotNull StockEvent.Cause cause) CallsStockIncreaseEvent.- Parameters:
stockHolder- the sourceStockHolderitem- the item that has set the amount of stockincrements- the amount of increasecurrentAmount- the amount of stock after increasecause- theStockEvent.Causethat is passed toStockHolder.increase(BoxItem, int, StockEvent.Cause)
-
callOverflowEvent
void callOverflowEvent(@NotNull @NotNull StockHolder stockHolder, @NotNull @NotNull BoxItem item, int increments, int excess, @NotNull StockEvent.Cause cause) CallsStockOverflowEvent.- Parameters:
stockHolder- the sourceStockHolderitem- the item that has set the amount of stockincrements- the amount of increase (excess is not included)excess- the amount exceedingInteger.MAX_VALUEcause- theStockEvent.Causethat is passed toStockHolder.increase(BoxItem, int, StockEvent.Cause)
-
callDecreaseEvent
void callDecreaseEvent(@NotNull @NotNull StockHolder stockHolder, @NotNull @NotNull BoxItem item, int decrements, int currentAmount, @NotNull StockEvent.Cause cause) CallsStockDecreaseEvent.- Parameters:
stockHolder- the sourceStockHolderitem- the item that has set the amount of stockdecrements- the amount of decreasecurrentAmount- the amount of stock after decreasecause- theStockEvent.Causethat is passed toStockHolder.decrease(BoxItem, int, StockEvent.Cause)or such methods
-
callResetEvent
void callResetEvent(@NotNull @NotNull StockHolder stockHolder, @NotNull @NotNull Collection<StockData> stockDataBeforeReset) CallsStockHolderResetEvent.- Parameters:
stockHolder- the sourceStockHolderstockDataBeforeReset- the collection ofStockDatabefore reset
-