Package org.bukkit.inventory
Interface Merchant
-
- All Known Subinterfaces:
AbstractVillager,Villager,WanderingTrader
public interface MerchantRepresents a merchant. A merchant is a special type of inventory which can facilitate custom trades between items.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description MerchantRecipegetRecipe(int i)Get the recipe at a certain index of this merchant's trade list.intgetRecipeCount()Get the number of trades this merchant currently has available.List<MerchantRecipe>getRecipes()Get a list of trades currently available from this merchant.HumanEntitygetTrader()Gets the player this merchant is trading with, or null if it is not currently trading.booleanisTrading()Gets whether this merchant is currently trading.voidsetRecipe(int i, MerchantRecipe recipe)Set the recipe at a certain index of this merchant's trade list.voidsetRecipes(List<MerchantRecipe> recipes)Set the list of trades currently available from this merchant.
-
-
-
Method Detail
-
getRecipes
@NotNull List<MerchantRecipe> getRecipes()
Get a list of trades currently available from this merchant.- Returns:
- an immutable list of trades
-
setRecipes
void setRecipes(@NotNull List<MerchantRecipe> recipes)Set the list of trades currently available from this merchant.
This will not change the selected trades of players currently trading with this merchant.- Parameters:
recipes- a list of recipes
-
getRecipe
@NotNull MerchantRecipe getRecipe(int i) throws IndexOutOfBoundsException
Get the recipe at a certain index of this merchant's trade list.- Parameters:
i- the index- Returns:
- the recipe
- Throws:
IndexOutOfBoundsException- if recipe index out of bounds
-
setRecipe
void setRecipe(int i, @NotNull MerchantRecipe recipe) throws IndexOutOfBoundsExceptionSet the recipe at a certain index of this merchant's trade list.- Parameters:
i- the indexrecipe- the recipe- Throws:
IndexOutOfBoundsException- if recipe index out of bounds
-
getRecipeCount
int getRecipeCount()
Get the number of trades this merchant currently has available.- Returns:
- the recipe count
-
isTrading
boolean isTrading()
Gets whether this merchant is currently trading.- Returns:
- whether the merchant is trading
-
getTrader
@Nullable HumanEntity getTrader()
Gets the player this merchant is trading with, or null if it is not currently trading.- Returns:
- the trader, or null
-
-