Class PoolTradeSlot

java.lang.Object
com.hypixel.hytale.builtin.adventure.shop.barter.TradeSlot
com.hypixel.hytale.builtin.adventure.shop.barter.PoolTradeSlot

public class PoolTradeSlot extends TradeSlot
A trade slot that randomly selects trades from a weighted pool. Selects slotCount unique trades (without replacement).

JSON format:

{
  "Type": "Pool",
  "SlotCount": 2,
  "Trades": [
    { "Weight": 50, "Output": {...}, "Input": [...], "Stock": [8, 12] },
    { "Weight": 30, "Output": {...}, "Input": [...], "Stock": [5] }
  ]
}
Stock can be a single value [10] or a range [min, max].
  • Field Details

  • Constructor Details

    • PoolTradeSlot

      public PoolTradeSlot(int slotCount, @Nonnull WeightedTrade[] trades)
  • Method Details

    • getPoolSlotCount

      public int getPoolSlotCount()
    • getTrades

      @Nonnull public WeightedTrade[] getTrades()
    • resolve

      @Nonnull public List<BarterTrade> resolve(@Nonnull Random random)
      Description copied from class: TradeSlot
      Resolve this slot into concrete trades.
      Specified by:
      resolve in class TradeSlot
      Parameters:
      random - Random source for weighted selection
      Returns:
      List of resolved BarterTrade instances
    • getSlotCount

      public int getSlotCount()
      Description copied from class: TradeSlot
      Get the number of trade slots this definition will produce.
      Specified by:
      getSlotCount in class TradeSlot
      Returns:
      Number of trades this slot will resolve to
    • toString

      @Nonnull public String toString()
      Overrides:
      toString in class Object