Package net.okocraft.box.api.model.stock
Interface StockEventCaller
public interface StockEventCaller
An interface that is used for calling
StockEvent
s from StockHolder
.-
Method Summary
Modifier and TypeMethodDescriptionvoid
callDecreaseEvent
(@NotNull StockHolder stockHolder, @NotNull BoxItem item, int decrements, int currentAmount, StockEvent.Cause cause) CallsStockDecreaseEvent
.void
callIncreaseEvent
(@NotNull StockHolder stockHolder, @NotNull BoxItem item, int increments, int currentAmount, StockEvent.Cause cause) CallsStockIncreaseEvent
.void
callOverflowEvent
(@NotNull StockHolder stockHolder, @NotNull BoxItem item, int increments, int excess, StockEvent.Cause cause) CallsStockOverflowEvent
.void
callResetEvent
(@NotNull StockHolder stockHolder, @NotNull Collection<StockData> stockDataBeforeReset) CallsStockHolderResetEvent
.void
callSetEvent
(@NotNull StockHolder stockHolder, @NotNull BoxItem item, int amount, int previousAmount, StockEvent.Cause cause) CallsStockSetEvent
.static @NotNull StockEventCaller
createDefault
(@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
- aEventCaller
to callStockEvent
s- 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 sourceStockHolder
item
- the item that has set the amount of stockamount
- the amount of stockpreviousAmount
- the amount of stock before setcause
- theStockEvent.Cause
that 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 sourceStockHolder
item
- the item that has set the amount of stockincrements
- the amount of increasecurrentAmount
- the amount of stock after increasecause
- theStockEvent.Cause
that 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 sourceStockHolder
item
- the item that has set the amount of stockincrements
- the amount of increase (excess is not included)excess
- the amount exceedingInteger.MAX_VALUE
cause
- theStockEvent.Cause
that 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 sourceStockHolder
item
- the item that has set the amount of stockdecrements
- the amount of decreasecurrentAmount
- the amount of stock after decreasecause
- theStockEvent.Cause
that 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 sourceStockHolder
stockDataBeforeReset
- the collection ofStockData
before reset
-