Package studio.magemonkey.genesis.core
Class GenesisBuy
java.lang.Object
studio.magemonkey.genesis.core.GenesisBuy
- Direct Known Subclasses:
GenesisBuyAdvanced
-
Constructor Summary
ConstructorsConstructorDescriptionGenesisBuy(GenesisRewardType rewardT, GenesisPriceType priceT, Object reward, Object price, String msg, int location, String permission, String name) GenesisBuy(GenesisRewardType rewardT, GenesisPriceType priceT, Object reward, Object price, String msg, int location, String permission, String name, GenesisCondition condition, GenesisInputType inputType, String inputText) -
Method Summary
Modifier and TypeMethodDescriptionvoidclick(org.bukkit.entity.Player p, GenesisShop shop, GenesisShopHolder holder, org.bukkit.event.inventory.ClickType clickType, org.bukkit.event.inventory.InventoryClickEvent event, Genesis plugin) booleanorg.bukkit.configuration.ConfigurationSectiongetExtraPermission(org.bukkit.event.inventory.ClickType clickType) getInputText(org.bukkit.event.inventory.ClickType clickType) getInputType(org.bukkit.event.inventory.ClickType clickType) intgetMessage(org.bukkit.event.inventory.ClickType clickType) getPrice(org.bukkit.event.inventory.ClickType clickType) getPriceType(org.bukkit.event.inventory.ClickType clickType) getReward(org.bukkit.event.inventory.ClickType clickType) getRewardType(org.bukkit.event.inventory.ClickType clickType) booleanhasPermission(org.bukkit.entity.Player p, boolean msg, org.bukkit.event.inventory.ClickType clickType) booleanisExtraPermissionExisting(org.bukkit.event.inventory.ClickType clickType) booleanisExtraPermissionGroup(org.bukkit.event.inventory.ClickType clickType) booleanbooleanmeetsCondition(GenesisShopHolder holder, org.bukkit.entity.Player p) voidpurchase(org.bukkit.entity.Player p, GenesisShop shop, GenesisShopHolder holder, org.bukkit.event.inventory.ClickType clickType, GenesisRewardType rewardType, GenesisPriceType priceType, org.bukkit.event.inventory.InventoryClickEvent event, Genesis plugin, boolean async) Deprecated.voidpurchaseTask(org.bukkit.entity.Player p, GenesisShop shop, GenesisShopHolder holder, org.bukkit.event.inventory.ClickType clickType, GenesisRewardType rewardType, GenesisPriceType priceType, org.bukkit.event.inventory.InventoryClickEvent event, Genesis plugin) voidpurchaseTry(org.bukkit.entity.Player p, GenesisShop shop, GenesisShopHolder holder, org.bukkit.event.inventory.ClickType clickType, org.bukkit.event.inventory.InventoryClickEvent event, Genesis plugin) Tries executing a purchase action.voidputSpecialInformation(org.bukkit.plugin.Plugin plugin, Object information) readSpecialInformation(org.bukkit.plugin.Plugin plugin) voidsetInventoryLocation(int i) Deprecated.voidsetItem(org.bukkit.inventory.ItemStack item, boolean fixItem) transformMessage(String msg, GenesisShop shop, org.bukkit.entity.Player p) Transforms the selected message by replacing price and reward placeholders with descriptions of price or reward.voidupdateShop(GenesisShop shop, org.bukkit.inventory.ItemStack menuitem, ClassManager manager, boolean addItem)
-
Constructor Details
-
GenesisBuy
public GenesisBuy(GenesisRewardType rewardT, GenesisPriceType priceT, Object reward, Object price, String msg, int location, String permission, String name, GenesisCondition condition, GenesisInputType inputType, String inputText) -
GenesisBuy
public GenesisBuy(GenesisRewardType rewardT, GenesisPriceType priceT, Object reward, Object price, String msg, int location, String permission, String name)
-
-
Method Details
-
getRewardType
-
getPriceType
-
getReward
-
getPrice
-
getMessage
-
getInputType
-
getInputText
-
getInventoryLocation
public int getInventoryLocation()- Returns:
- real inventory location with 0 as first possible one and -1 as "next available slot".
-
setInventoryLocation
Deprecated. -
isItemFix
public boolean isItemFix() -
meetsCondition
-
containsConditions
public boolean containsConditions() -
getConfigurationSection
public org.bukkit.configuration.ConfigurationSection getConfigurationSection(GenesisConfigShop shop) -
hasPermission
public boolean hasPermission(org.bukkit.entity.Player p, boolean msg, org.bukkit.event.inventory.ClickType clickType) -
isExtraPermissionExisting
public boolean isExtraPermissionExisting(org.bukkit.event.inventory.ClickType clickType) -
isExtraPermissionGroup
public boolean isExtraPermissionGroup(org.bukkit.event.inventory.ClickType clickType) -
getExtraPermission
-
readSpecialInformation
-
transformMessage
Transforms the selected message by replacing price and reward placeholders with descriptions of price or reward. If player is null only player-independent placeholders are replaced. Additionally item placeholders like amount, material and more are replaced.
The method needs to be executed once the item is created (player=null):
- to replace all player-independent placeholders
- to mark the related shop as customizable if it contains player-dependent placeholders
- to detect the inputType of this shopItem. If it is not null (default is null) players need to enter input before purchases are made
The method also needs to be executed when a certain player accesses the item (player!=null):
- to replace all player-dependent placeholders- Parameters:
msg- Message to transform.shop- Shop this shopItem belongs to.p- Related player. Can be null.- Returns:
- transformed message.
-
updateShop
public void updateShop(GenesisShop shop, org.bukkit.inventory.ItemStack menuitem, ClassManager manager, boolean addItem) -
putSpecialInformation
-
setItem
public void setItem(org.bukkit.inventory.ItemStack item, boolean fixItem) -
click
public void click(org.bukkit.entity.Player p, GenesisShop shop, GenesisShopHolder holder, org.bukkit.event.inventory.ClickType clickType, org.bukkit.event.inventory.InventoryClickEvent event, Genesis plugin) -
purchaseTry
public void purchaseTry(org.bukkit.entity.Player p, GenesisShop shop, GenesisShopHolder holder, org.bukkit.event.inventory.ClickType clickType, org.bukkit.event.inventory.InventoryClickEvent event, Genesis plugin) Tries executing a purchase action. Fails if the player is unable to buy the item or unable to pay the price.- Parameters:
p- Player to click purchase.shop- Shop this shopItem belongs to.holder- Holder of the shop.clickType- ClickType.event- Click event which caused purchase. Can be null (for example when click is simulated).plugin- Genesis plugin.
-
purchaseTask
public void purchaseTask(org.bukkit.entity.Player p, GenesisShop shop, GenesisShopHolder holder, org.bukkit.event.inventory.ClickType clickType, GenesisRewardType rewardType, GenesisPriceType priceType, org.bukkit.event.inventory.InventoryClickEvent event, Genesis plugin) Triggerspurchase(Player, GenesisShop, GenesisShopHolder, ClickType, GenesisRewardType, GenesisPriceType, InventoryClickEvent, Genesis, boolean). This is done asynchronously ifSettings.getPurchaseAsync()= true.- Parameters:
p- Player to purchase the item.shop- Shop this shopItem belongs to.holder- Holder of the shop.clickType- ClickType.rewardType- RewardType.priceType- PriceType.event- Click event which caused purchase. Can be null (for example when click is simulated).plugin- Genesis plugin.
-
purchase
@Deprecated public void purchase(org.bukkit.entity.Player p, GenesisShop shop, GenesisShopHolder holder, org.bukkit.event.inventory.ClickType clickType, GenesisRewardType rewardType, GenesisPriceType priceType, org.bukkit.event.inventory.InventoryClickEvent event, Genesis plugin, boolean async) Deprecated.Actions:
- take price from player (price might depend on rewardType)
- optionally close the inventory
- give reward to player (reward might depend on priceType; executed asynchronously if async=true and the rewardType supports it)
- optionally logs transaction in transactionslog
- take price from player
- sends purchase message to player
- optionally plays purchase sound
- updates shop if needed and inventory still open (done asynchronously if async=true)- Parameters:
p- Player to purchase the item.shop- Shop this shopItem belongs to.holder- Holder of the shop.clickType- Clicktype.rewardType- Rewardtype.priceType- Pricetype.event- Click event which caused purchase. Can be null (for example when click is simulated).plugin- Bossshop plugin.async- Whether actions which can be executed asynchronously should be.
-