Contents
- Description
- Field Summary
- Constructor Summary
- Method Summary
- Field Details
- Constructor Details
- Method Details
- getCurrentStock()
- getNextRefreshTime()
- setNextRefreshTime(Instant)
- getResolveSeed()
- setResolveSeed(Long)
- getResolvedTrades(BarterShopAsset)
- resetStockAndResolve(BarterShopAsset)
- resetStock(BarterShopAsset)
- expandStockIfNeeded(BarterShopAsset)
- hasStock(int, int)
- decrementStock(int, int)
- getStock(int)
Class BarterShopState.ShopInstanceState
java.lang.Object
com.hypixel.hytale.builtin.adventure.shop.barter.BarterShopState.ShopInstanceState
- Enclosing class:
BarterShopState
State for a single shop instance.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleandecrementStock(int tradeIndex, int quantity) Decrement stock for a trade.booleanExpand stock array if new trades were added.int[]getResolvedTrades(BarterShopAsset asset) Get or resolve trades for a shop.intgetStock(int tradeIndex) booleanhasStock(int tradeIndex, int quantity) Check if trade at given index has stock available.voidresetStock(BarterShopAsset asset) Deprecated.Use resetStockAndResolve for shops with TradeSlotsvoidReset stock to max values and re-resolve trades with new seed.voidsetNextRefreshTime(Instant time) voidsetResolveSeed(Long seed)
-
Field Details
-
BARTER_TRADES
-
INTS
@Nonnull public static final int[] INTS
-
-
Constructor Details
-
ShopInstanceState
public ShopInstanceState() -
ShopInstanceState
public ShopInstanceState(int tradeCount)
-
-
Method Details
-
getCurrentStock
public int[] getCurrentStock() -
getNextRefreshTime
-
setNextRefreshTime
-
getResolveSeed
-
setResolveSeed
-
getResolvedTrades
Get or resolve trades for a shop. For legacy shops (using Trades array), returns the static trades. For shops with TradeSlots, resolves using the stored seed. -
resetStockAndResolve
Reset stock to max values and re-resolve trades with new seed. -
resetStock
Deprecated.Use resetStockAndResolve for shops with TradeSlotsReset stock to max values from the asset. -
expandStockIfNeeded
Expand stock array if new trades were added.Existing trades keep their current stock, new trades get max stock.
- Returns:
trueif stock was expanded,falseif no expansion was needed.
-
hasStock
public boolean hasStock(int tradeIndex, int quantity) Check if trade at given index has stock available. -
decrementStock
public boolean decrementStock(int tradeIndex, int quantity) Decrement stock for a trade.- Returns:
- true if successful, false if not enough stock.
-
getStock
public int getStock(int tradeIndex)
-