Package org.bukkit.inventory
Class MerchantRecipe
java.lang.Object
org.bukkit.inventory.MerchantRecipe
- All Implemented Interfaces:
- Recipe
public class MerchantRecipe extends Object implements Recipe
Represents a merchant's trade.
 Trades can take one or two ingredients, and provide one result. The
 ingredients' ItemStack amounts are respected in the trade.
 
A trade has a limited number of uses, after which the trade can no longer be used, unless the player uses a different trade, which will cause its maximum uses to increase.
A trade may or may not reward experience for being completed.
A trade has a limited number of uses, after which the trade can no longer be used, unless the player uses a different trade, which will cause its maximum uses to increase.
A trade may or may not reward experience for being completed.
- See Also:
- VillagerReplenishTradeEvent
- 
Constructor SummaryConstructors Constructor Description MerchantRecipe(ItemStack result, int maxUses)MerchantRecipe(ItemStack result, int uses, int maxUses, boolean experienceReward)MerchantRecipe(ItemStack result, int uses, int maxUses, boolean experienceReward, int villagerExperience, float priceMultiplier)
- 
Method SummaryModifier and Type Method Description voidaddIngredient(ItemStack item)List<ItemStack>getIngredients()intgetMaxUses()Get the maximum number of uses this trade has.floatgetPriceMultiplier()Gets the additive price multiplier for the cost of this trade.ItemStackgetResult()Get the result of this recipe.intgetUses()Get the number of times this trade has been used.intgetVillagerExperience()Gets the amount of experience the villager earns from this trade.booleanhasExperienceReward()Whether to reward experience to the player for the trade.voidremoveIngredient(int index)voidsetExperienceReward(boolean flag)Set whether to reward experience to the player for the trade.voidsetIngredients(List<ItemStack> ingredients)voidsetMaxUses(int maxUses)Set the maximum number of uses this trade has.voidsetPriceMultiplier(float priceMultiplier)Sets the additive price multiplier for the cost of this trade.voidsetUses(int uses)Set the number of times this trade has been used.voidsetVillagerExperience(int villagerExperience)Sets the amount of experience the villager earns from this trade.
- 
Constructor Details
- 
Method Details- 
getResultDescription copied from interface:RecipeGet the result of this recipe.
- 
addIngredient
- 
removeIngredientpublic void removeIngredient(int index)
- 
setIngredients
- 
getIngredients
- 
getUsespublic int getUses()Get the number of times this trade has been used.- Returns:
- the number of uses
 
- 
setUsespublic void setUses(int uses)Set the number of times this trade has been used.- Parameters:
- uses- the number of uses
 
- 
getMaxUsespublic int getMaxUses()Get the maximum number of uses this trade has.
 The maximum uses of this trade may increase when a player trades with the owning merchant.- Returns:
- the maximum number of uses
 
- 
setMaxUsespublic void setMaxUses(int maxUses)Set the maximum number of uses this trade has.- Parameters:
- maxUses- the maximum number of time this trade can be used
 
- 
hasExperienceRewardpublic boolean hasExperienceReward()Whether to reward experience to the player for the trade.- Returns:
- whether to reward experience to the player for completing this trade
 
- 
setExperienceRewardpublic void setExperienceReward(boolean flag)Set whether to reward experience to the player for the trade.- Parameters:
- flag- whether to reward experience to the player for completing this trade
 
- 
getVillagerExperiencepublic int getVillagerExperience()Gets the amount of experience the villager earns from this trade.- Returns:
- villager experience
 
- 
setVillagerExperiencepublic void setVillagerExperience(int villagerExperience)Sets the amount of experience the villager earns from this trade.- Parameters:
- villagerExperience- new experience amount
 
- 
getPriceMultiplierpublic float getPriceMultiplier()Gets the additive price multiplier for the cost of this trade.- Returns:
- price multiplier
 
- 
setPriceMultiplierpublic void setPriceMultiplier(float priceMultiplier)Sets the additive price multiplier for the cost of this trade.- Parameters:
- priceMultiplier- new price multiplier
 
 
-