Interface NovaMarket
public interface NovaMarket
Represents the Novaconomy Market
- Since:
- 1.7.1
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidaddBlacklistedMaterial(@NotNull Material material) Adds a blacklisted material to the Novaconomy Market.default voidaddCustomItem(@NotNull Material material, @NotNull MarketCategory category, double price) Adds a custom item to the Novaconomy Market.default voidAdds stock to a Material on the Market.@NotNull Receiptbuy(@NotNull OfflinePlayer buyer, @NotNull Material m, int amount, @NotNull Economy econ) Buys a Material from the Market.Fetches an immutable copy of all of the purchases ever on the Novaconomy Market.Fetches an immutable set of all of the items sold on the Novaconomy Market.Sets the economies disallowed to be used when buying from the Novaconomy Market.Fetches an immutable list of all of the blacklisted materials that won't be sold on the Novaconomy Market.@NotNull Set<MarketItem>Fetches an immutable set of all of the items additionally added to the Novaconomy Market.@Nullable DateFetches the timestamp for when the last restock event occured.static FileFetches the file that the Novaconomy Market information is stored in.doubleFetches the one-time fee a player must pay to gain access to the Novaconomy Market.default doublegetMarketMembershipCost(double scale) Fetches the one-time fee a player must pay to gain access to the Novaconomy Market, factoring an Economy's conversion scale.default doublegetMarketMembershipCost(@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.longFetches the base amount of how much the Novaconomy Market restocks.longFetches the interval at which the Novaconomy Market automatically restocks itself.longFetches the maximum amount of purchases a player can make in a single day (20 minutes).doubleFetches the price of a Material on the Market.default doubleFetches the price of a Material on the Market, factoring an Economy's conversion scale.default doubleFetches the price of a Material on the Market, factoring an Economy's conversion scale.Fetches an unmodifiable configuration-set price of all of the Materials.Fetches an immutable set of all of the recent purchases.doubleFetches the number that is multiplied by the market price to get the money back from selling the material of the same type.longFetches the amount of stock of a Material on the Market that is available to purchase.Fetches an immutable set of all economies allowed to be used when buying from the Novaconomy Market.booleanWhether money made from the Novaconomy Market is deposited into the Novaconomy Bank.booleanWhether Novaconomy Market features are currently enabled.booleanWhether the Market Membership feature is enabled.booleanWhether the Novaconomy Market automatically restocks itself.booleanFetches whether items players sell on the Novaconomy Market will be added to that item's stock.default booleanFetches whether a material is currently sold on the Novaconomy Market.default voidremoveBlacklistedMaterial(@NotNull Material material) Removes a blacklisted material from the Novaconomy Market.voidremoveCustomItem(@NotNull Material material) Remove a custom item from the Novaconomy Market.default voidremoveStock(@NotNull Material m, long remove) Removes stock from a Material on the Market.voidsetBlacklistedEconomies(@NotNull Iterable<Economy> economies) Sets the economies disallowed to be used when buying from the Novaconomy Market.voidsetBlacklistedMaterials(@NotNull Iterable<Material> materials) Sets the blacklisted materials that won't be sold on the Novaconomy Market.default voidsetBlacklistedMaterials(@NotNull Material... materials) Sets the blacklisted materials that won't be sold on the Novaconomy Market.voidsetCustomItems(@NotNull Iterable<MarketItem> items) Sets the custom items that will be added to the Novaconomy Market.voidsetDepositEnabled(boolean enabled) Sets whether money made from the Novaconomy Market is deposited into the Novaconomy Bank.voidsetMarketEnabled(boolean enabled) Sets whether Novaconomy Market features are currently enabled.voidsetMarketMembershipCost(double cost) Sets the base one-time fee a player must pay to gain access to the Novaconomy Market.voidsetMarketMembershipEnabled(boolean enabled) Sets whether the Market Membership feature is enabled.voidsetMarketRestockAmount(long amount) Sets the base amount of how much the Novaconomy Market restocks.voidsetMarketRestockEnabled(boolean enabled) Sets whether the Novaconomy Market automatically restocks itself.voidsetMarketRestockInterval(long interval) Sets the interval at which the Novaconomy Market automatically restocks itself.voidsetMaxPurchases(long maxPurchases) Sets the maximum amount of purchases a player can make in a single day (20 minutes).voidsetPriceOverrides(@NotNull Map<Material, Double> overrides) Sets the configuration-set price of all of the Materials.voidsetPriceOverrides(@NotNull Material m, double price) Sets the configuration-set price of a Material.voidsetSellPercentage(double percentage) Sets the sell percentage.voidsetSellStockEnabled(boolean enabled) Sets whether sell stock is enabled.voidSets the amount of stock for Materials on the Market.voidSets the amount of stock of a Material on the Market.voidsetWhitelistedEconomies(@NotNull Iterable<Economy> economies) Sets the economies allowed to be used when buying from the Novaconomy Market.
-
Method Details
-
getMarketFile
Fetches the file that the Novaconomy Market information is stored in.- Returns:
- Market File
-
getPrice
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 fetchecon- Economy to use- Returns:
- Price of the Material for the Economy
- Throws:
IllegalArgumentException- if the Material is not on the Market
-
getPrice
Fetches the price of a Material on the Market, factoring an Economy's conversion scale.- Parameters:
m- Material to fetchscale- Scale to use- Returns:
- Price of the Material for the Economy
- Throws:
IllegalArgumentException- if the Material is not on the Market
-
isSold
Fetches whether a material is currently sold on the Novaconomy Market.- Parameters:
m- Material to check- Returns:
- true if sold, else false
-
getAllSold
Fetches an immutable set of all of the items sold on the Novaconomy Market.- Returns:
- Set of all sold items
-
getStock
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
Sets the amount of stock of a Material on the Market.- Parameters:
m- Material to setstock- Stock to set- Throws:
IllegalArgumentException- if stock is negative
-
setStock
void setStock(@NotNull @NotNull Iterable<Material> materials, long stock) throws IllegalArgumentException Sets the amount of stock for Materials on the Market.- Parameters:
materials- Materials to setstock- Stock to set- Throws:
IllegalArgumentException- if stock is negative
-
addStock
Adds stock to a Material on the Market.- Parameters:
m- Material to addadd- Stock to add
-
removeStock
Removes stock from a Material on the Market.- Parameters:
m- Material to removeremove- 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 Materialm- Material to buyamount- Amount of the Material to buyecon- 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 moneyCancellationException- ifPlayerMarketPurchaseEventwas 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
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 IllegalArgumentExceptionSets 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
Sets the configuration-set price of a Material.- Parameters:
m- Material to setprice- 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 is10000.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
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
Fetches an immutable copy of all of the purchases ever on the Novaconomy Market.- Returns:
- Set of Receipts
-
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
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
Fetches the timestamp for when the last restock event occured.- Returns:
- Last Restock Timestamp, or null if hasn't restocked yet
-
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
Adds a blacklisted material to the Novaconomy Market.- Parameters:
material- Material to add
-
removeBlacklistedMaterial
Removes a blacklisted material from the Novaconomy Market.- Parameters:
material- Material to remove
-
setBlacklistedMaterials
Sets the blacklisted materials that won't be sold on the Novaconomy Market.- Parameters:
materials- Iterable of Materials
-
setBlacklistedMaterials
Sets the blacklisted materials that won't be sold on the Novaconomy Market.- Parameters:
materials- Array of Materials
-
getCustomItems
Fetches an immutable set of all of the items additionally added to the Novaconomy Market.- Returns:
- Set of Market Items
-
setCustomItems
Sets the custom items that will be added to the Novaconomy Market.- Parameters:
items- Map of Materials to their Price
-
addCustomItem
default void addCustomItem(@NotNull @NotNull Material material, @NotNull @NotNull MarketCategory category, double price) Adds a custom item to the Novaconomy Market.- Parameters:
material- Material to addprice- Price of the Material
-
removeCustomItem
Remove a custom item from the Novaconomy Market.- Parameters:
material- Material to remove
-
getWhitelistedEconomies
Fetches an immutable set of all economies allowed to be used when buying from the Novaconomy Market.- Returns:
- Set of Economies
-
setWhitelistedEconomies
Sets the economies allowed to be used when buying from the Novaconomy Market.- Parameters:
economies- Iterable of Economies
-
getBlacklistedEconomies
Sets the economies disallowed to be used when buying from the Novaconomy Market.- Returns:
- Set of Economies
-
setBlacklistedEconomies
Sets the economies disallowed to be used when buying from the Novaconomy Market.- Parameters:
economies- Iterable of Economies
-