Interface TradeOfferGenerator.Builder
- All Superinterfaces:
AbstractBuilder<TradeOfferGenerator>
,Builder<TradeOfferGenerator,
,TradeOfferGenerator.Builder> CopyableBuilder<TradeOfferGenerator,
,TradeOfferGenerator.Builder> ResettableBuilder<TradeOfferGenerator,
TradeOfferGenerator.Builder>
- Enclosing interface:
- TradeOfferGenerator
public static interface TradeOfferGenerator.Builder
extends Builder<TradeOfferGenerator,TradeOfferGenerator.Builder>, CopyableBuilder<TradeOfferGenerator,TradeOfferGenerator.Builder>
A simple builder to create a
TradeOfferGenerator
.-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds a newTradeOfferGenerator
.experienceChance
(double experienceChance) Sets the chance whenRandom.nextDouble()
is called where if the double is greater than the desired experience chance, the generatedTradeOffer
will grant experience upon a successful trade.firstBuyingItemGenerator
(ItemStackGenerator generator) Sets theItemStackGenerator
for creating the primary item to be bought by the merchant.grantedExperience
(VariableAmount amount) maxUses
(VariableAmount amount) Sets theVariableAmount
of maximum uses of the generatedTradeOffer
.secondBuyingItemGenerator
(@Nullable ItemStackGenerator generator) Sets the secondItemStackGenerator
for creating the secondary item to be bought by the merchant.sellingItemGenerator
(ItemStackGenerator sellingGenerator) Sets the buyingItemStackGenerator
for creating the selling item that players are buying.startingUses
(VariableAmount amount) Sets theVariableAmount
of starting uses for the generatedTradeOffer
.Methods inherited from interface org.spongepowered.api.util.CopyableBuilder
from
-
Method Details
-
firstBuyingItemGenerator
Sets theItemStackGenerator
for creating the primary item to be bought by the merchant.- Parameters:
generator
- The generator that will create the first purchased itemstack- Returns:
- This builder, for chaining
-
secondBuyingItemGenerator
Sets the secondItemStackGenerator
for creating the secondary item to be bought by the merchant.- Parameters:
generator
- The generator that will create (if not null) the second purchased itemstack- Returns:
- This builder, for chaining
-
sellingItemGenerator
Sets the buyingItemStackGenerator
for creating the selling item that players are buying.- Parameters:
sellingGenerator
- The generator that will create the selling item- Returns:
- This builder, for chaining
-
experienceChance
Sets the chance whenRandom.nextDouble()
is called where if the double is greater than the desired experience chance, the generatedTradeOffer
will grant experience upon a successful trade.- Parameters:
experienceChance
- The experience chance- Returns:
- This builder, for chaining
-
grantedExperience
-
startingUses
Sets theVariableAmount
of starting uses for the generatedTradeOffer
.- Parameters:
amount
- The variable amount of starting uses- Returns:
- This builder, for chaining
-
maxUses
Sets theVariableAmount
of maximum uses of the generatedTradeOffer
.- Parameters:
amount
- The variable amount of maximum uses- Returns:
- This builder, for chaining
-
build
TradeOfferGenerator build()Builds a newTradeOfferGenerator
.- Specified by:
build
in interfaceAbstractBuilder<TradeOfferGenerator>
- Returns:
- The newly created generator
-