Interface NovaMarket


public interface NovaMarket
Represents the Novaconomy Market
Since:
1.7.1
  • Method Details

    • getMarketFile

      static File getMarketFile()
      Fetches the file that the Novaconomy Market information is stored in.
      Returns:
      Market File
    • getPrice

      double getPrice(@NotNull @NotNull Material m) throws IllegalArgumentException
      Fetches the price of a Material on the Market.
      Parameters:
      m - Material to fetch
      Returns:
      Price of the Material
      Throws:
      IllegalArgumentException - if the Material is not on the Market
    • getPrice

      default double getPrice(@NotNull @NotNull Material m, @Nullable @Nullable Economy econ) throws IllegalArgumentException
      Fetches the price of a Material on the Market, factoring an Economy's conversion scale.
      Parameters:
      m - Material to fetch
      econ - Economy to use
      Returns:
      Price of the Material for the Economy
      Throws:
      IllegalArgumentException - if the Material is not on the Market
    • getPrice

      default double getPrice(@NotNull @NotNull Material m, double scale) throws IllegalArgumentException
      Fetches the price of a Material on the Market, factoring an Economy's conversion scale.
      Parameters:
      m - Material to fetch
      scale - Scale to use
      Returns:
      Price of the Material for the Economy
      Throws:
      IllegalArgumentException - if the Material is not on the Market
    • isSold

      default boolean isSold(@NotNull @NotNull Material m)
      Fetches whether a material is currently sold on the Novaconomy Market.
      Parameters:
      m - Material to check
      Returns:
      true if sold, else false
    • getAllSold

      @NotNull @NotNull Set<Material> getAllSold()
      Fetches an immutable set of all of the items sold on the Novaconomy Market.
      Returns:
      Set of all sold items
    • getStock

      long getStock(@NotNull @NotNull Material m)
      Fetches the amount of stock of a Material on the Market that is available to purchase.
      Parameters:
      m - Material to fetch
      Returns:
      Stock of the Material
    • setStock

      void setStock(@NotNull @NotNull Material m, long stock) throws IllegalArgumentException
      Sets the amount of stock of a Material on the Market.
      Parameters:
      m - Material to set
      stock - Stock to set
      Throws:
      IllegalArgumentException - if stock is negative
    • addStock

      default void addStock(@NotNull @NotNull Material m, long add)
      Adds stock to a Material on the Market.
      Parameters:
      m - Material to add
      add - Stock to add
    • removeStock

      default void removeStock(@NotNull @NotNull Material m, long remove)
      Removes stock from a Material on the Market.
      Parameters:
      m - Material to remove
      remove - Stock to remove
    • buy

      @NotNull @NotNull Receipt buy(@NotNull @NotNull OfflinePlayer buyer, @NotNull @NotNull Material m, int amount, @NotNull @NotNull Economy econ) throws IllegalArgumentException, CancellationException
      Buys a Material from the Market. This method does not add the material to their inventory, only makes a receipt.
      Parameters:
      buyer - Player buying the Material
      m - Material to buy
      amount - Amount of the Material to buy
      econ - Economy to buy with
      Returns:
      Receipt of the Transaction
      Throws:
      IllegalArgumentException - if amount is not positive, not enough stock, or player does not have enough money
      CancellationException - if PlayerMarketPurchaseEvent was cancelled
    • isMarketEnabled

      boolean isMarketEnabled()
      Whether Novaconomy Market features are currently enabled.
      Returns:
      true if enabled, else false
    • setMarketEnabled

      void setMarketEnabled(boolean enabled)
      Sets whether Novaconomy Market features are currently enabled.
      Parameters:
      enabled - true if enabled, else false
    • isMarketRestockEnabled

      boolean isMarketRestockEnabled()
      Whether the Novaconomy Market automatically restocks itself.
      Returns:
      true if enabled, else false
    • setMarketRestockEnabled

      void setMarketRestockEnabled(boolean enabled)
      Sets whether the Novaconomy Market automatically restocks itself.
      Parameters:
      enabled - true if enabled, else false
    • getMarketRestockInterval

      long getMarketRestockInterval()
      Fetches the interval at which the Novaconomy Market automatically restocks itself.
      Returns:
      Restock interval
    • setMarketRestockInterval

      void setMarketRestockInterval(long interval)
      Sets the interval at which the Novaconomy Market automatically restocks itself.
      Parameters:
      interval - Restock interval
    • getMarketRestockAmount

      long getMarketRestockAmount()
      Fetches the base amount of how much the Novaconomy Market restocks.
      Returns:
      Base Restock Amount
    • setMarketRestockAmount

      void setMarketRestockAmount(long amount)
      Sets the base amount of how much the Novaconomy Market restocks.
      Parameters:
      amount - Base Restock Amount
    • getPriceOverrides

      @NotNull @NotNull Map<Material,Double> getPriceOverrides()
      Fetches an unmodifiable configuration-set price of all of the Materials.
      Returns:
      Map of Material to Price
    • setPriceOverrides

      void setPriceOverrides(@NotNull @NotNull Map<Material,Double> overrides) throws IllegalArgumentException
      Sets the configuration-set price of all of the Materials.
      Parameters:
      overrides - Map of Material to Price
      Throws:
      IllegalArgumentException - if map is null, materials are null, or prices are negative
    • setPriceOverrides

      void setPriceOverrides(@NotNull @NotNull Material m, double price) throws IllegalArgumentException
      Sets the configuration-set price of a Material.
      Parameters:
      m - Material to set
      price - Price
      Throws:
      IllegalArgumentException - if material is null or price is negative
    • isDepositEnabled

      boolean isDepositEnabled()
      Whether money made from the Novaconomy Market is deposited into the Novaconomy Bank.
      Returns:
      true if enabled, else false
    • setDepositEnabled

      void setDepositEnabled(boolean enabled)
      Sets whether money made from the Novaconomy Market is deposited into the Novaconomy Bank.
      Parameters:
      enabled - true if enabled, else false
    • getMaxPurchases

      long getMaxPurchases()
      Fetches the maximum amount of purchases a player can make in a single day (20 minutes).
      Returns:
      Maximum amount of purchases, or -1 if unlimited
    • setMaxPurchases

      void setMaxPurchases(long maxPurchases)
      Sets the maximum amount of purchases a player can make in a single day (20 minutes).
      Parameters:
      maxPurchases - Maximum amount of Purchases (-1 for unlimited)
    • isMarketMembershipEnabled

      boolean isMarketMembershipEnabled()

      Whether the Market Membership feature is enabled.

      If enabled, players will have to pay a one-time fee to gain access to the Novaconomy Market.

      Returns:
      true if enabled, else false
    • setMarketMembershipEnabled

      void setMarketMembershipEnabled(boolean enabled)
      Sets whether the Market Membership feature is enabled.
      Parameters:
      enabled - true if enabled, else false
      See Also:
    • getMarketMembershipCost

      double getMarketMembershipCost()
      Fetches the one-time fee a player must pay to gain access to the Novaconomy Market. Default is 10000.0.
      Returns:
      Market Membership Cost
    • getMarketMembershipCost

      default double getMarketMembershipCost(double scale)
      Fetches the one-time fee a player must pay to gain access to the Novaconomy Market, factoring an Economy's conversion scale.
      Parameters:
      scale - Scale to use
      Returns:
      Market Membership Cost
    • getMarketMembershipCost

      default double getMarketMembershipCost(@Nullable @Nullable Economy econ)
      Fetches the one-time fee a player must pay to gain access to the Novaconomy Market, factoring an Economy's conversion scale.
      Parameters:
      econ - Economy to use
      Returns:
      Market Membership Cost
    • setMarketMembershipCost

      void setMarketMembershipCost(double cost)
      Sets the base one-time fee a player must pay to gain access to the Novaconomy Market.
      Parameters:
      cost - Market Membership Cost
    • getAllPurchases

      @NotNull @NotNull Set<Receipt> getAllPurchases()
      Fetches an immutable copy of all of the purchases ever on the Novaconomy Market.
      Returns:
      Set of Receipts
    • getRecentPurchases

      @NotNull default @NotNull Set<Receipt> getRecentPurchases()
      Fetches an immutable set of all of the recent purchases.
      Returns:
      Set of Receipts
    • getSellPercentage

      double getSellPercentage()
      Fetches the number that is multiplied by the market price to get the money back from selling the material of the same type.
      Returns:
      Sell Percentage
    • setSellPercentage

      void setSellPercentage(double percentage) throws IllegalArgumentException
      Sets the sell percentage.
      Parameters:
      percentage - Sell Percentage
      Throws:
      IllegalArgumentException - if percentage is not positive
      See Also:
    • isSellStockEnabled

      boolean isSellStockEnabled()
      Fetches whether items players sell on the Novaconomy Market will be added to that item's stock.
      Returns:
      true if enabled, else false
    • setSellStockEnabled

      void setSellStockEnabled(boolean enabled)
      Sets whether sell stock is enabled.
      Parameters:
      enabled - true if enabled, else false
      See Also:
    • getLastRestockTimestamp

      @Nullable @Nullable Date getLastRestockTimestamp()
      Fetches the timestamp for when the last restock event occured.
      Returns:
      Last Restock Timestamp, or null if hasn't restocked yet
    • getBlacklistedMaterials

      @NotNull @NotNull List<Material> getBlacklistedMaterials()
      Fetches an immutable list of all of the blacklisted materials that won't be sold on the Novaconomy Market.
      Returns:
      List of Materials
    • addBlacklistedMaterial

      default void addBlacklistedMaterial(@NotNull @NotNull Material material)
      Adds a blacklisted material to the Novaconomy Market.
      Parameters:
      material - Material to add
    • removeBlacklistedMaterial

      default void removeBlacklistedMaterial(@NotNull @NotNull Material material)
      Removes a blacklisted material from the Novaconomy Market.
      Parameters:
      material - Material to remove
    • setBlacklistedMaterials

      void setBlacklistedMaterials(@NotNull @NotNull Iterable<Material> materials)
      Sets the blacklisted materials that won't be sold on the Novaconomy Market.
      Parameters:
      materials - Iterable of Materials
    • setBlacklistedMaterials

      default void setBlacklistedMaterials(@NotNull @NotNull Material... materials)
      Sets the blacklisted materials that won't be sold on the Novaconomy Market.
      Parameters:
      materials - Array of Materials