Interface TradeOffer
- All Superinterfaces:
- DataSerializable
- 
Nested Class SummaryNested ClassesModifier and TypeInterfaceDescriptionstatic interfaceRepresents a builder to generate immutableTradeOffers.
- 
Method SummaryModifier and TypeMethodDescriptionstatic TradeOffer.Builderbuilder()Creates a newTradeOffer.Builderto build aTradeOffer.intGets the demand bonus for this trade offer.booleanGets whether this trade offer will grant experience to the customer upon usage or not.intGets the amount of experience granted to the merchant when this trade offer is used.Gets the first buying item.booleanChecks if this trade offer has indeed passed the time of which the uses surpassed the maximum uses.booleanReturns whether this trade offer has a second item the merchant is buying from the customer.intmaxUses()Gets the current maximum uses of this offer.doubleGets the rate at which this trade offer's price will grow when demand for an item increases.Gets the second buying item.Gets the selling item theMerchantwill give to the customer often in exchange for a single item or sometimes, two items from the following methods:firstBuyingItem()andsecondBuyingItem().intuses()Gets the current uses of this offer.Methods inherited from interface org.spongepowered.api.data.persistence.DataSerializablecontentVersion, toContainer
- 
Method Details- 
builderCreates a newTradeOffer.Builderto build aTradeOffer.- Returns:
- The new builder
 
- 
firstBuyingItemItemStackSnapshot firstBuyingItem()Gets the first buying item.The first buying item is an item that the customer is selling to the merchant in exchange for sellingItem().- Returns:
- The first buying item
 
- 
hasSecondItemboolean hasSecondItem()Returns whether this trade offer has a second item the merchant is buying from the customer.- Returns:
- True if there is a second buying item
 
- 
secondBuyingItemOptional<ItemStackSnapshot> secondBuyingItem()Gets the second buying item. The second buying item is an item that the customer is selling to the merchant, along with the firstBuyingItem(), in exchange forsellingItem().- Returns:
- The second buying item, if available
 
- 
sellingItemItemStackSnapshot sellingItem()Gets the selling item theMerchantwill give to the customer often in exchange for a single item or sometimes, two items from the following methods:firstBuyingItem()andsecondBuyingItem().- Returns:
- The selling item
 
- 
usesint uses()Gets the current uses of this offer. Usually, the uses of an offer are limited by the amount of maxUses(). Once the uses reaches the max uses, the offer may temporarily become disabled.- Returns:
- The current uses of this trade offer
 
- 
maxUsesint maxUses()Gets the current maximum uses of this offer. Usually, the uses of an offer are limited by the amount of maximum uses. Once the uses reaches the max uses, the offer may temporarily become disabled. - Returns:
- The maximum uses of this trade offer
 
- 
hasExpiredboolean hasExpired()Checks if this trade offer has indeed passed the time of which the uses surpassed the maximum uses.- Returns:
- True if the uses have surpassed the maximum uses
 
- 
doesGrantExperienceboolean doesGrantExperience()Gets whether this trade offer will grant experience to the customer upon usage or not.- Returns:
- True if using this trade offer will grant experience to the customer
 
- 
experienceGrantedToMerchantint experienceGrantedToMerchant()Gets the amount of experience granted to the merchant when this trade offer is used.- Returns:
- The experience to be granted to the merchant
 
- 
priceGrowthMultiplierdouble priceGrowthMultiplier()Gets the rate at which this trade offer's price will grow when demand for an item increases. Every time a villager trades, this value is multiplied by the current price of the offer and the demand bonus.If this value is 0, demand will have no effect on this offer's price. - Returns:
- the price growth multiplier
- See Also:
 
- 
demandBonusint demandBonus()Gets the demand bonus for this trade offer.- Returns:
- the demand bonus
 
 
-