Interface ShopProduct
- All Known Subinterfaces:
CommandShopProduct
,ItemShopProduct
,SpawnerItemShopProduct
,SpecialItemShopProduct
public interface ShopProduct
-
Method Summary
Modifier and TypeMethodDescriptionint
Returns the amount that will be given to the playerdefault String
Returns the name of this product in the default configured language.
This method might return something like "Iron", "Bronze", "A command" or something else configured by the usergetDisplayName
(@Nullable CommandSender sender) Returns the name of this product that can be presented to the given sender.
This method might return something like "Iron", "Bronze", "A command" or something else configured by the usergetGivingItems
(Player player, @Nullable Team team, @Nullable Arena arena, int multiplier) Gets the ItemStacks the player will actually receive.getId()
Returns the unique id of this instance.getItem()
Returns the item to which the product has been added togetType()
Products may vary on what they effectively give to the player.
This returns what exactly it'll be giving to the playervoid
Gives the product to a player.void
give
(Player player, @Nullable Team team, @Nullable Arena arena, int multiplier, @Nullable Integer targetInvSlot) Gives the product to a player.boolean
Returns whether or not this item is automatically getting worn on purchaseboolean
Returns if this item is able to obtain any damageboolean
setAmount
(int amount) Set the amount that will be given to the player.
Not any product type does support this operation, those who don't support it will return falsevoid
setAutoWear
(boolean autowear) Set whether or not this item shall be automatically worn on purchasevoid
setUnbreakable
(boolean unbreakable) Set whether or not this item shall be able to obtain damage
-
Method Details
-
getItem
ShopItem getItem()Returns the item to which the product has been added to- Returns:
- The item to which the product was added to
-
getType
ShopProductType getType()Products may vary on what they effectively give to the player.
This returns what exactly it'll be giving to the player- Returns:
- The type of this product
-
getId
UUID getId()Returns the unique id of this instance.Keep in mind that this will change whenever the plugin gets reloaded!
- Returns:
- The unique id of this product
-
getAmount
int getAmount()Returns the amount that will be given to the player- Returns:
- The amount that will be given to the player
-
setAmount
boolean setAmount(int amount) Set the amount that will be given to 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
-
getDisplayName
Returns the name of this product that can be presented to the given sender.
This method might return something like "Iron", "Bronze", "A command" or something else configured by the user- Parameters:
sender
- Uses his local info to return the name in the right language- Returns:
- The display name of this product
-
getDisplayName
Returns the name of this product in the default configured language.
This method might return something like "Iron", "Bronze", "A command" or something else configured by the user- Returns:
- The display name of this product
-
isAutoWear
boolean isAutoWear()Returns whether or not this item is automatically getting worn on purchase- Returns:
- If this item is being auto worn
-
setAutoWear
void setAutoWear(boolean autowear) Set whether or not this item shall be automatically worn on purchase- Parameters:
autowear
- The new value
-
isUnbreakable
boolean isUnbreakable()Returns if this item is able to obtain any damage- Returns:
- If the item obtains any damage on use
-
setUnbreakable
void setUnbreakable(boolean unbreakable) Set whether or not this item shall be able to obtain damage- Parameters:
unbreakable
- The new value
-
give
void give(Player player, @Nullable @Nullable Team team, @Nullable @Nullable Arena arena, int multiplier) Gives the product to a player.The team and the arena parameters are optional. Some product features won't be applied if they're
null
. This includes: automatic dying and enchantments gained from upgrades- Parameters:
player
- The player to which the item shall be given to. Names will also be automatically translated into the language of this playerteam
- The team in which the player is in. Can benull
arena
- The arena in which the player is in. Can benull
multiplier
- How many times this product shall be given to the player. Should be at least 1, or otherwise no effect will be seen- See Also:
-
give
void give(Player player, @Nullable @Nullable Team team, @Nullable @Nullable Arena arena, int multiplier, @Nullable @Nullable Integer targetInvSlot) Gives the product to a player.The team and the arena parameters are optional. Some product features won't be applied if they're
null
. This includes: automatic dying and enchantments gained from upgrades- Parameters:
player
- The player to which the item shall be given to. Names will also be automatically translated into the language of this playerteam
- The team in which the player is in. Can benull
arena
- The arena in which the player is in. Can benull
multiplier
- How many times this product shall be given to the player. Should be at least 1, or otherwise no effect will be seentargetInvSlot
- The slot to which the item shall be (at least tried) added to. Can benull
if that doesn't matter
-
getGivingItems
ItemStack[] getGivingItems(Player player, @Nullable @Nullable Team team, @Nullable @Nullable Arena arena, int multiplier) Gets the ItemStacks the player will actually receive.The team and the arena parameters are optional. Some product features won't be applied if they're
null
. This includes: automatic dying and enchantments gained from upgrades- Parameters:
player
- The player to which the item shall be given to. Names will also be automatically translated into the language of this playerteam
- The team in which the player is in. Can benull
arena
- The arena in which the player is in. Can benull
multiplier
- How many times this product shall be given to the player. Should be at least 1, or otherwise we will return an empty array
-