Class GenesisBuy

java.lang.Object
studio.magemonkey.genesis.core.GenesisBuy
Direct Known Subclasses:
GenesisBuyAdvanced

public class GenesisBuy extends Object
  • Constructor Details

  • Method Details

    • getRewardType

      public GenesisRewardType getRewardType(org.bukkit.event.inventory.ClickType clickType)
    • getPriceType

      public GenesisPriceType getPriceType(org.bukkit.event.inventory.ClickType clickType)
    • getReward

      public Object getReward(org.bukkit.event.inventory.ClickType clickType)
    • getPrice

      public Object getPrice(org.bukkit.event.inventory.ClickType clickType)
    • getMessage

      public String getMessage(org.bukkit.event.inventory.ClickType clickType)
    • getInputType

      public GenesisInputType getInputType(org.bukkit.event.inventory.ClickType clickType)
    • getInputText

      public String getInputText(org.bukkit.event.inventory.ClickType clickType)
    • getInventoryLocation

      public int getInventoryLocation()
      Returns:
      real inventory location with 0 as first possible one and -1 as "next available slot".
    • setInventoryLocation

      @Deprecated public void setInventoryLocation(int i)
      Deprecated.
    • isItemFix

      public boolean isItemFix()
    • meetsCondition

      public boolean meetsCondition(GenesisShopHolder holder, org.bukkit.entity.Player p)
    • 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

      public String getExtraPermission(org.bukkit.event.inventory.ClickType clickType)
    • readSpecialInformation

      public Object readSpecialInformation(org.bukkit.plugin.Plugin plugin)
    • transformMessage

      public String 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. 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

      public void putSpecialInformation(org.bukkit.plugin.Plugin plugin, Object information)
    • 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)
      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.