Class BarterShopState.ShopInstanceState

java.lang.Object
com.hypixel.hytale.builtin.adventure.shop.barter.BarterShopState.ShopInstanceState
Enclosing class:
BarterShopState

public static class BarterShopState.ShopInstanceState extends Object
State for a single shop instance.
  • Field Details

    • BARTER_TRADES

      @Nonnull public static final BarterTrade[] 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

      @Nullable public Instant getNextRefreshTime()
    • setNextRefreshTime

      public void setNextRefreshTime(@Nonnull Instant time)
    • getResolveSeed

      @Nullable public Long getResolveSeed()
    • setResolveSeed

      public void setResolveSeed(Long seed)
    • getResolvedTrades

      @Nonnull public BarterTrade[] getResolvedTrades(@Nonnull BarterShopAsset asset)
      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

      public void resetStockAndResolve(@Nonnull BarterShopAsset asset)
      Reset stock to max values and re-resolve trades with new seed.
    • resetStock

      @Deprecated public void resetStock(@Nonnull BarterShopAsset asset)
      Deprecated.
      Use resetStockAndResolve for shops with TradeSlots
      Reset stock to max values from the asset.
    • expandStockIfNeeded

      public boolean expandStockIfNeeded(@Nonnull BarterShopAsset asset)
      Expand stock array if new trades were added.

      Existing trades keep their current stock, new trades get max stock.

      Returns:
      true if stock was expanded, false if 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)