Class MVEconomist
- java.lang.Object
- 
- com.onarandombox.MultiverseCore.utils.MVEconomist
 
- 
 public class MVEconomist extends java.lang.ObjectMultiverse's Friendly Economist. This is used to deal with external economies and also item costs for stuff in MV.
- 
- 
Constructor SummaryConstructors Constructor Description MVEconomist(org.bukkit.plugin.Plugin plugin)
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voiddeposit(org.bukkit.entity.Player player, double amount, @Nullable org.bukkit.Material currency)Deposits a given amount of currency either into the player's economy account or inventory if the currency is not null.java.lang.StringformatPrice(double amount, @Nullable org.bukkit.Material currency)Formats the amount to a human readable currency string.doublegetBalance(org.bukkit.entity.Player player)Returns the economy balance of the given player.doublegetBalance(org.bukkit.entity.Player player, org.bukkit.World world)Returns the economy balance of the given player in the given world.java.lang.StringgetEconomyName()Returns the name of the economy in use.java.lang.StringgetNSFMessage(org.bukkit.Material currency, java.lang.String message)Formats a message for a player indicating they don't have enough currency.VaultHandlergetVaultHandler()Deprecated.just use the other methods in this class for economy stuff.static booleanisItemCurrency(org.bukkit.Material currency)Determines if the currency type string given represents an item currency.booleanisPlayerWealthyEnough(org.bukkit.entity.Player player, double amount, org.bukkit.Material currency)Determines if a player has enough of a given currency.booleanisUsingEconomyPlugin()Checks if an economy plugin is in use.voidsetBalance(org.bukkit.entity.Player player, double amount)Sets the economy balance for the given player.voidsetBalance(org.bukkit.entity.Player player, org.bukkit.World world, double amount)Sets the economy balance for the given player in the given world.voidwithdraw(org.bukkit.entity.Player player, double amount, @Nullable org.bukkit.Material currency)Withdraws a given amount of currency either from the player's economy account or inventory if the currency is not null.
 
- 
- 
- 
Method Detail- 
isUsingEconomyPluginpublic boolean isUsingEconomyPlugin() Checks if an economy plugin is in use.- Returns:
- true if an economy plugin is detected by Vault.
 
 - 
formatPricepublic java.lang.String formatPrice(double amount, @Nullable @Nullable org.bukkit.Material currency)Formats the amount to a human readable currency string.- Parameters:
- amount- the amount of currency.
- currency- the type of currency. Null indicates a non-item currency is used.
- Returns:
- the human readable currency string.
 
 - 
getEconomyNamepublic java.lang.String getEconomyName() Returns the name of the economy in use.- Returns:
- the name of the economy in use.
 
 - 
isPlayerWealthyEnoughpublic boolean isPlayerWealthyEnough(org.bukkit.entity.Player player, double amount, org.bukkit.Material currency)Determines if a player has enough of a given currency.- Parameters:
- player- the player to check for currency.
- amount- the amount of currency.
- currency- the type of currency. Null indicates non-item currency is used.
- Returns:
- true if the player has enough of the given currency or the amount is 0 or less.
 
 - 
getNSFMessagepublic java.lang.String getNSFMessage(org.bukkit.Material currency, java.lang.String message)Formats a message for a player indicating they don't have enough currency.- Parameters:
- currency- the type of currency. Null indicates a non-item currency is used.
- message- The more specific message to append to the generic message of not having enough.
- Returns:
- the formatted insufficient funds message.
 
 - 
depositpublic void deposit(org.bukkit.entity.Player player, double amount, @Nullable @Nullable org.bukkit.Material currency)Deposits a given amount of currency either into the player's economy account or inventory if the currency is not null.- Parameters:
- player- the player to give currency to.
- amount- the amount to give.
- currency- the type of currency.
 
 - 
withdrawpublic void withdraw(org.bukkit.entity.Player player, double amount, @Nullable @Nullable org.bukkit.Material currency)Withdraws a given amount of currency either from the player's economy account or inventory if the currency is not null.- Parameters:
- player- the player to take currency from.
- amount- the amount to take.
- currency- the type of currency.
 
 - 
getBalancepublic double getBalance(org.bukkit.entity.Player player) throws java.lang.IllegalStateExceptionReturns the economy balance of the given player.- Parameters:
- player- the player to get the balance for.
- Returns:
- the economy balance of the given player.
- Throws:
- java.lang.IllegalStateException- thrown if this is used when no economy plugin is available.
 
 - 
getBalancepublic double getBalance(org.bukkit.entity.Player player, org.bukkit.World world) throws java.lang.IllegalStateExceptionReturns the economy balance of the given player in the given world. If the economy plugin does not have world specific balances then the global balance will be returned.- Parameters:
- player- the player to get the balance for.
- world- the world to get the balance for.
- Returns:
- the economy balance of the given player in the given world.
- Throws:
- java.lang.IllegalStateException- thrown if this is used when no economy plugin is available.
 
 - 
setBalancepublic void setBalance(org.bukkit.entity.Player player, double amount) throws java.lang.IllegalStateExceptionSets the economy balance for the given player.- Parameters:
- player- the player to set the balance for.
- amount- the amount to set the player's balance to.
- Throws:
- java.lang.IllegalStateException- thrown if this is used when no economy plugin is available.
 
 - 
setBalancepublic void setBalance(org.bukkit.entity.Player player, org.bukkit.World world, double amount) throws java.lang.IllegalStateExceptionSets the economy balance for the given player in the given world. If the economy plugin does not have world specific balances then the global balance will be set.- Parameters:
- player- the player to set the balance for.
- world- the world to get the balance for.
- amount- the amount to set the player's balance to.
- Throws:
- java.lang.IllegalStateException- thrown if this is used when no economy plugin is available.
 
 - 
getVaultHandler@Deprecated public VaultHandler getVaultHandler() Deprecated.just use the other methods in this class for economy stuff.This method is public for backwards compatibility.- Returns:
- the old VaultHandler.
 
 - 
isItemCurrencypublic static boolean isItemCurrency(org.bukkit.Material currency) Determines if the currency type string given represents an item currency.- Parameters:
- currency- the type of currency.
- Returns:
- true if currency string matches a valid material.
 
 
- 
 
-