Interface ShopPrice
- All Known Subinterfaces:
ItemShopPrice
,SpawnerItemShopPrice
public interface ShopPrice
-
Method Summary
Modifier and TypeMethodDescriptionint
Returns the amount that will be takengetDisplayItem
(Player player) Returns the item that'll be displayed in (shop) GUIsdefault String
Returns the name of the price (e.g.default String
getDisplayName
(int amount) Returns the name of the price (e.g.getDisplayName
(@Nullable CommandSender sender) Returns the name of the price (e.g.getDisplayName
(@Nullable CommandSender sender, int amount) Returns the name of the price (e.g.int
Returns the general amount that will be takendefault int
getHoldingAmount
(Player player) Returns the amount of instances the player is holding (in his inventory)int
getHoldingAmount
(Player player, @Nullable ItemStack[] inv) Returns the amount of instances the player is holding (in his inventory)getItem()
Returns the item to which the price has been added todefault int
getMissingAmount
(Player player) Returns the amount of instances (i.a. item) the player is missing to pay the priceint
getMissingAmount
(Player player, @Nullable ItemStack[] inv) Returns the amount of instances (i.a. item) the player is missing to pay the pricegetType()
Prices can vary from their type.boolean
setGeneralAmount
(int amount) Set the general amount that will be taken from the player.
Not any product type does support this operation, those who don't support it will return falsedefault boolean
Takes the price from the playerboolean
Takes the price from the player
-
Method Details
-
getItem
ShopItem getItem()Returns the item to which the price has been added to- Returns:
- The item to which the price was added to
-
getType
ShopPriceType getType()Prices can vary from their type. Meaning that one takes an item from the player while something else does something different- Returns:
- The type of this price
-
getDisplayName
Returns the name of the price (e.g. "Iron", "Diamond") in the language of the sender- Parameters:
sender
- The language of him. Uses the default language when passing null- Returns:
- The display name
-
getDisplayName
Returns the name of the price (e.g. "Command", "Iron", "Dirt") in the default language- Returns:
- The display name
-
getDisplayName
Returns the name of the price (e.g. "Iron", "Diamond") in the language of the sender- Parameters:
sender
- The language of him. Uses the default language when passing nullamount
- the amount of material required- Returns:
- The display name
-
getDisplayName
Returns the name of the price (e.g. "Command", "Iron", "Dirt") in the default language- Parameters:
amount
- the amount of material required- Returns:
- The display name
-
getDisplayItem
Returns the item that'll be displayed in (shop) GUIs- Parameters:
player
- Item might vary per player- Returns:
- The ItemStack that can be used for displaying in GUIs
-
getAmount
Returns the amount that will be taken- Parameters:
player
- Might vary per player- Returns:
- The amount
-
getGeneralAmount
int getGeneralAmount()Returns the general amount that will be taken- Returns:
- The amount
-
setGeneralAmount
boolean setGeneralAmount(int amount) Set the general amount that will be taken from the player.
Not any product type does support this operation, those who don't support it will return false- Parameters:
amount
- The new amount- Returns:
- If this operation is being supported by the type
-
getHoldingAmount
Returns the amount of instances the player is holding (in his inventory)Example: If the player has 9 iron and the price for him is 2 iron, then this method returns 4.
- Parameters:
player
- The player we want to checkinv
- The theoretical inventory from which it shall be taken.null
if it shall use the players inventory- Returns:
- The amount he's holding
-
getHoldingAmount
Returns the amount of instances the player is holding (in his inventory)Example: If the player has 9 iron and the price for him is 2 iron, then this method returns 4.
- Parameters:
player
- The player we want to check- Returns:
- The amount he's holding
-
getMissingAmount
Returns the amount of instances (i.a. item) the player is missing to pay the priceExample: If the player has 2 iron and the price for him is 5 iron, then this method returns 3.
- Parameters:
player
- The player we want to checkinv
- The theoretical inventory from which it shall be taken.null
if it shall use the players inventory- Returns:
- The amount he's missing
-
getMissingAmount
Returns the amount of instances (i.a. item) the player is missing to pay the priceExample: If the player has 2 iron and the price for him is 5 iron, then this method returns 3.
- Parameters:
player
- The player we want to check- Returns:
- The amount he's missing
-
take
Takes the price from the playerMight fail (returns
false
) when the player does not hold enough.- Parameters:
player
- The target playermultiplier
- This multiplied withgetAmount(Player)
equals the final amount that will be takeninv
- The theoretical inventory from which it shall be taken.null
if it shall use the players inventory- Returns:
- True if everything has been taken from him, otherwise false
-
take
Takes the price from the playerMight fail (returns
false
) when the player does not hold enough.- Parameters:
player
- The target playermultiplier
- This multiplied withgetAmount(Player)
equals the final amount that will be taken- Returns:
- True if everything has been taken from him, otherwise false
-