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 generatedTradeOfferwill grant experience upon a successful trade.firstBuyingItemGenerator(ItemStackGenerator generator) Sets theItemStackGeneratorfor creating the primary item to be bought by the merchant.grantedExperience(VariableAmount amount) maxUses(VariableAmount amount) Sets theVariableAmountof maximum uses of the generatedTradeOffer.secondBuyingItemGenerator(@Nullable ItemStackGenerator generator) Sets the secondItemStackGeneratorfor creating the secondary item to be bought by the merchant.sellingItemGenerator(ItemStackGenerator sellingGenerator) Sets the buyingItemStackGeneratorfor creating the selling item that players are buying.startingUses(VariableAmount amount) Sets theVariableAmountof starting uses for the generatedTradeOffer.Methods inherited from interface org.spongepowered.api.util.CopyableBuilder
from
-
Method Details
-
firstBuyingItemGenerator
Sets theItemStackGeneratorfor 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 secondItemStackGeneratorfor 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 buyingItemStackGeneratorfor 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 generatedTradeOfferwill grant experience upon a successful trade.- Parameters:
experienceChance- The experience chance- Returns:
- This builder, for chaining
-
grantedExperience
-
startingUses
Sets theVariableAmountof starting uses for the generatedTradeOffer.- Parameters:
amount- The variable amount of starting uses- Returns:
- This builder, for chaining
-
maxUses
Sets theVariableAmountof 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:
buildin interfaceAbstractBuilder<TradeOfferGenerator>- Returns:
- The newly created generator
-