Interface ShopItem
- All Superinterfaces:
- Cloneable
- 
Method SummaryModifier and TypeMethodDescriptionaddPriceItem(ItemStack price, int amount) Adds an ItemStack price to this instance.addPriceSpawner(DropType price, int amount) Adds a Spawner price to this instance.addProductCommand(String command, boolean executeAsConsole) Adds a product that executes a command when this item is being bought.addProductItem(ItemStack item, int amount) Adds a product that gives the player an ItemStack when this item is being bought.addProductSpawner(DropType dropType, int amount) Adds a product that gives the player a spawner drops when this item is being bought.addProductSpecialItem(SpecialItem specialItem, int amount) Adds a product that gives the player a SpecialItem when this item is being bought.Make the player buy the item.default intcalcPurchasableQuantity(Player player) Returns the amount of how often the player could purchase this item in the invoked momentintcalcPurchasableQuantity(Player player, @Nullable ItemStack[] inv) Returns the amount of how often the player could purchase this item in the invoked momentclone()Returns a clone of this instance.@Nullable BuyGroupReturns the buy-group of the item.intReturns the buy-group level of this item.@Nullable StringGet the required buy permission id for shop item purchase.intGet the max amount that'll be multiplied when shift-clicking the item in the shop.@Nullable StringReturns the unformatted description as it is written in the configs.default @Nullable StringReturns the formatted description of the item in the default language.@Nullable StringgetDescription(@Nullable CommandSender sender) Returns the formatted description in the language of the sender.default StringReturns the formatted name of the item in the default language.getDisplayName(@Nullable CommandSender sender) Returns the formatted name in the language of the sender.@Nullable IntegerReturns the slot at which it'll be placed at after the rendering of the shop layout GUI Can be null if it shouldn't do thatgetIcon()Returns the icon that will be shown in the shop GUI.getId()Get the id of this item.getName()Returns its unformatted name as it is in the config file.Returns the original "non-cloned" instance.getPage()Returns the page in which the item is inside.Returns the prices that will be taken from the player when he's trying to buy the item.List<? extends ShopProduct> Returns the products that will be given to the buyer.@Nullable ArenaConditionGroupThe ArenaConditionGroup that controls what arenas this ShopItem is visible in.booleanReturns if the item is a member of a buy-group or not.booleanhasBuyPermission(Player player) Weather or not a player has permission to buy this item.booleanisClone()Checks whether this instance is a clone (as if it has been cloned usingclone()).booleanGet whether the id of this item has been auto-generated or not.booleanReturns whether the item will be kept when the player dies.booleanReturns whether the item can be only bought once.booleanremovePrice(ShopPrice price) Removes a price instance from this item.booleanremoveProduct(ShopProduct product) Removes a product instance from this item.voidsetBuyGroup(@Nullable BuyGroup buyGroup) Set the new buy-group of this item or remove it from an existing one.voidsetBuyGroupLevel(int level) Set the buy-group level of this item.voidsetBuyPermissionId(@Nullable String permissionId) Set a required buy permission for players.voidsetCapsMultiply(int capsMultiply) Set the max amount that'll be multiplied when shift-clicking the item in the shop.voidsetConfigDescription(@Nullable String description) Change the description of the item.voidsetForceSlot(@Nullable Integer forceSlot) Define at which it shall be forced at after the rendering of the shop GUI
 Can be null if it shouldn't do thatvoidSet the icon that shall be shown in the shop GUI.voidsetKeptOnDeath(boolean keepOnDeath) Define whether the item shall be kept on death.voidChanges the name of this ShopItem.voidsetOneTimePurchase(boolean oneTimePurchase) Define whether the item can be only bought once.voidsetRestriction(@Nullable ArenaConditionGroup restriction) Lets you restrict this ShopItem, so only be available in certain arenas
- 
Method Details- 
getIdString getId()Get the id of this item.Note that specifying the id in the configs file is optional file. If it's not specified, it'll be automatically generated. If auto-generated, then isIdAutogenerated()will returntrue.In case it is auto-generated, a combination of name, icon and page will be used. - Returns:
- The id of the item. Unique towards other items, yet persistent after restarts
 
- 
isIdAutogeneratedboolean isIdAutogenerated()Get whether the id of this item has been auto-generated or not.- Returns:
- trueif the id has been auto-generated, otherwise- false
- See Also:
 
- 
getNameString getName()Returns its unformatted name as it is in the config file.- Returns:
- The name of the item
 
- 
setNameChanges the name of this ShopItem.- Parameters:
- name- the new name of this item
 
- 
getDisplayNameReturns the formatted name of the item in the default language.- Returns:
- The display name in the default language
 
- 
getDisplayNameReturns the formatted name in the language of the sender.- Parameters:
- sender- The person
- Returns:
- The display name in the language of the sender
 
- 
getDescriptionReturns the formatted description of the item in the default language.- Returns:
- The description in the default language. May be nullwhen it doesn't have one
 
- 
getDescriptionReturns the formatted description in the language of the sender.- Parameters:
- sender- The person
- Returns:
- The description in the language of the sender. May be nullwhen it doesn't have one
 
- 
getConfigDescriptionReturns the unformatted description as it is written in the configs.- Returns:
- The unformatted description. May be nullwhen it doesn't have one
 
- 
setConfigDescriptionChange the description of the item.- Parameters:
- description- The new unformatted description. May be- null
 
- 
getPageShopPage getPage()Returns the page in which the item is inside.- Returns:
- The page in which the item has been added
 
- 
getPricesReturns the prices that will be taken from the player when he's trying to buy the item.- Returns:
- The price for this item
 
- 
getProductsList<? extends ShopProduct> getProducts()Returns the products that will be given to the buyer.- Returns:
- The products of this item
 
- 
addPriceItemAdds an ItemStack price to this instance.The type of the returned instance is equal to ShopPriceType.ITEM.- Parameters:
- price- The material required for the purchase
- amount- The amount of material required for the purchase
- Returns:
- The price created and applied to the item
 
- 
addPriceSpawnerAdds a Spawner price to this instance.The type of the returned instance is equal to ShopPriceType.SPAWNER_ITEM.- Parameters:
- price- The DropType required for the purchase
- amount- The amount of material required for the purchase
- Returns:
- The price created and applied to the item
 
- 
removePriceRemoves a price instance from this item.- Parameters:
- price- The instance that shall be removed
- Returns:
- trueif it's a part of this item and if it has been removed. Otherwise- false
 
- 
addProductCommandAdds a product that executes a command when this item is being bought.The type of the returned instance is equal to ShopProductType.COMMAND.- Parameters:
- command- The command that will be executed on a successful purchase
- executeAsConsole- Whether the command shall be executed as the console (true) or as the player (false)
- Returns:
- The product created and applied to the item
 
- 
addProductItemAdds a product that gives the player an ItemStack when this item is being bought.The type of the returned instance is equal to ShopProductType.ITEM.- Parameters:
- item- The ItemStack the player will receive on a successful purchase
- amount- The amount of items the player will receive
- Returns:
- The product created and applied to the item
 
- 
addProductSpawnerAdds a product that gives the player a spawner drops when this item is being bought.The type of the returned instance is equal to ShopProductType.ITEM.- Parameters:
- dropType- The DropType the player will receive on a successful purchase
- amount- The amount of items the player will receive
- Returns:
- The product created and applied to the item
 
- 
addProductSpecialItemAdds a product that gives the player a SpecialItem when this item is being bought.The type of the returned instance is equal to ShopProductType.ITEM.- Parameters:
- specialItem- The special item that the player will receive when he buys the item
- amount- The amount of items the player will receive
- Returns:
- The product created and applied to the item
 
- 
removeProductRemoves a product instance from this item.- Parameters:
- product- The instance that shall be removed
- Returns:
- trueif it's a part of this item and if it has been removed. Otherwise- false
 
- 
getIconItemStack getIcon()Returns the icon that will be shown in the shop GUI.- Returns:
- The icon
 
- 
setIconSet the icon that shall be shown in the shop GUI.- Parameters:
- icon- The new icon
 
- 
getCapsMultiplyint getCapsMultiply()Get the max amount that'll be multiplied when shift-clicking the item in the shop.- Returns:
- The caps-multiply
 
- 
setCapsMultiplyvoid setCapsMultiply(int capsMultiply) Set the max amount that'll be multiplied when shift-clicking the item in the shop.- Parameters:
- capsMultiply- The new value
 
- 
isKeptOnDeathboolean isKeptOnDeath()Returns whether the item will be kept when the player dies.- Returns:
- If the item will be kept on death
 
- 
setKeptOnDeathvoid setKeptOnDeath(boolean keepOnDeath) Define whether the item shall be kept on death.- Parameters:
- keepOnDeath- The new value
 
- 
isOneTimePurchaseboolean isOneTimePurchase()Returns whether the item can be only bought once.- Returns:
- If the item can only be bought once
 
- 
setOneTimePurchasevoid setOneTimePurchase(boolean oneTimePurchase) Define whether the item can be only bought once.- Parameters:
- oneTimePurchase- The new value
 
- 
getBuyGroupReturns the buy-group of the item. Might benullif it isn't in any.- Returns:
- The buy-group of this item
 
- 
setBuyGroupSet the new buy-group of this item or remove it from an existing one.- Parameters:
- buyGroup- Its new buy-group, or- nullto remove it from the existing one
 
- 
hasBuyGroupboolean hasBuyGroup()Returns if the item is a member of a buy-group or not.- Returns:
- trueif it has a buy-group, otherwise- false
 
- 
getBuyGroupLevelint getBuyGroupLevel()Returns the buy-group level of this item.It might be return a non -1 number even tho it's currently not in any buy-group. - Returns:
- Its buy-group level
 
- 
setBuyGroupLevelvoid setBuyGroupLevel(int level) Set the buy-group level of this item.The change is even being (temporarily) being applied even when it currently is not a member of one. - Parameters:
- level- Its new buy-group level
 
- 
hasBuyPermissionWeather or not a player has permission to buy this item.- Parameters:
- player- The player we want to check
 
- 
setBuyPermissionIdSet a required buy permission for players. The full permission will look like 'shopitem.id' Can be null if there should be no buy permission- Parameters:
- permissionId- The ID the custom buy permission should have.- nullis there should be none.
 
- 
getBuyPermissionIdGet the required buy permission id for shop item purchase. The full permission will look like 'shopitem.id' Can be null if there is no buy permission set- Returns:
- The id of the required by permission. nullif there is no permission set.
 
- 
getForceSlotReturns the slot at which it'll be placed at after the rendering of the shop layout GUI Can be null if it shouldn't do that- Returns:
- The slot at which it shall be forced at
 
- 
setForceSlotDefine at which it shall be forced at after the rendering of the shop GUI
 Can be null if it shouldn't do that- Parameters:
- forceSlot- The new value
 
- 
getRestrictionThe ArenaConditionGroup that controls what arenas this ShopItem is visible in.- Returns:
- The condition that states the arenas this ShopItem will be available in. nullif the ShopItem should be displayed in every arena.
 
- 
setRestrictionLets you restrict this ShopItem, so only be available in certain arenas- Parameters:
- restriction- The condition that states the arenas this ShopItem will be available in.- nullif the ShopItem should be displayed in every arena.
 
- 
calcPurchasableQuantityReturns the amount of how often the player could purchase this item in the invoked moment- Parameters:
- player- The player we want to check
- inv- The theoretical inventory from which it shall be taken.- nullif it shall use the players inventory
- Returns:
- The quantity of purchase instances the player could theoretically have in this moment
 
- 
calcPurchasableQuantityReturns the amount of how often the player could purchase this item in the invoked moment- Parameters:
- player- The player we want to check
- Returns:
- The quantity of purchase instances the player could theoretically have in this moment
 
- 
buyMake the player buy the item.Note that it will automatically make use of getOriginal(), as it is not possible to buy cloned items. Procedure is exactly the same as if the player would click by himself on the given item.- Parameters:
- player- The player who is supposed to
- isShiftClick- Whether he held shift during the purchase (Meaning that it's supposed to bought in stacks)
- Returns:
- The result of the purchase
 
- 
isCloneboolean isClone()Checks whether this instance is a clone (as if it has been cloned usingclone()).ShopItems are cloned in some cases (e.g. when a shop is opened) to allow you to modify the shop without affecting other arenas. - Returns:
- whether this BuyGroup is a clone
- See Also:
 
- 
getOriginalShopItem getOriginal()Returns the original "non-cloned" instance.This will return the original instance from which the clone has been created from. In case isClone()returns false, the same instance is being returned.- Returns:
- The original non-cloned instance
- See Also:
 
- 
cloneShopItem clone()Returns a clone of this instance.- Returns:
- A clone of this instance
- See Also:
 
 
-