Package dev.satyrn.xpeconomy.economy
Class ExperienceEconomy
java.lang.Object
dev.satyrn.xpeconomy.economy.ExperienceEconomy
- All Implemented Interfaces:
ConfigurationConsumer,net.milkbowl.vault.economy.Economy
public final class ExperienceEconomy
extends Object
implements net.milkbowl.vault.economy.Economy, ConfigurationConsumer
The XP Economy handler.
-
Constructor Summary
ConstructorsConstructorDescriptionExperienceEconomy(org.bukkit.plugin.Plugin plugin, AccountManager accountManager, Configuration configuration) Creates a new instance of the Economy class. -
Method Summary
Modifier and TypeMethodDescriptionnet.milkbowl.vault.economy.EconomyResponsebankBalance(String name) Returns the amount the bank hasnet.milkbowl.vault.economy.EconomyResponsebankDeposit(String name, double amount) Deposit an amount into a bank account - DO NOT USE NEGATIVE AMOUNTSnet.milkbowl.vault.economy.EconomyResponseReturns true or false whether the bank has the amount specified - DO NOT USE NEGATIVE AMOUNTSnet.milkbowl.vault.economy.EconomyResponsebankWithdraw(String name, double amount) Withdraw an amount from a bank account - DO NOT USE NEGATIVE AMOUNTSnet.milkbowl.vault.economy.EconomyResponsecreateBank(String name, String player) Deprecated.net.milkbowl.vault.economy.EconomyResponsecreateBank(String name, org.bukkit.OfflinePlayer player) Creates a bank account with the specified name and the player as the ownerbooleancreatePlayerAccount(String playerName) Deprecated.As of VaultAPI 1.4 use {createPlayerAccount(OfflinePlayer)instead.booleancreatePlayerAccount(String playerName, String worldName) Deprecated.As of VaultAPI 1.4 use {createPlayerAccount(OfflinePlayer, String)instead.booleancreatePlayerAccount(org.bukkit.OfflinePlayer player) Attempts to create a player account for the given playerbooleancreatePlayerAccount(org.bukkit.OfflinePlayer player, String worldName) Attempts to create a player account for the given player on the specified world IMPLEMENTATION SPECIFIC - if an economy plugin does not support this then false will always be returned.Returns the name of the currency in plural form.Returns the name of the currency in singular form.net.milkbowl.vault.economy.EconomyResponsedeleteBank(String name) Deletes a bank account with the specified name.net.milkbowl.vault.economy.EconomyResponsedepositPlayer(String playerName, double amount) Deprecated.As of VaultAPI 1.4 usedepositPlayer(OfflinePlayer, double)instead.net.milkbowl.vault.economy.EconomyResponsedepositPlayer(String playerName, String worldName, double amount) Deprecated.As of VaultAPI 1.4 usedepositPlayer(OfflinePlayer, String, double)instead.net.milkbowl.vault.economy.EconomyResponsedepositPlayer(org.bukkit.OfflinePlayer player, double amount) Deposit an amount to a player - DO NOT USE NEGATIVE AMOUNTSnet.milkbowl.vault.economy.EconomyResponsedepositPlayer(org.bukkit.OfflinePlayer player, String worldName, double amount) Deposit an amount to a player - DO NOT USE NEGATIVE AMOUNTS IMPLEMENTATION SPECIFIC - if an economy plugin does not support this the global balance will be returned.format(double amount) Format amount into a human readable String This provides translation into economy specific formatting to improve consistency between plugins.intSome economy plugins round off after a certain number of digits.doublegetBalance(String playerName) Deprecated.As of VaultAPI 1.4 usegetBalance(OfflinePlayer)instead.doublegetBalance(String playerName, String world) Deprecated.As of VaultAPI 1.4 usegetBalance(OfflinePlayer, String)instead.doublegetBalance(org.bukkit.OfflinePlayer player) Gets balance of a playerdoublegetBalance(org.bukkit.OfflinePlayer player, String world) Gets balance of a player on the specified world.getBanks()Gets the list of banksgetName()Gets name of economy methodbooleanDeprecated.As of VaultAPI 1.4 usehas(OfflinePlayer, double)instead.booleanDeprecated.As of VaultAPI 1.4 use @{linkhas(OfflinePlayer, String, double)instead.booleanhas(org.bukkit.OfflinePlayer player, double amount) Checks if the player account has the amount - DO NOT USE NEGATIVE AMOUNTSbooleanChecks if the player account has the amount in a given world - DO NOT USE NEGATIVE AMOUNTS IMPLEMENTATION SPECIFIC - if an economy plugin does not support this the global balance will be returned.booleanhasAccount(String playerName) Deprecated.As of VaultAPI 1.4 usehasAccount(OfflinePlayer)instead.booleanhasAccount(String playerName, String worldName) Deprecated.As of VaultAPI 1.4 usehasAccount(OfflinePlayer, String)instead.booleanhasAccount(org.bukkit.OfflinePlayer player) Checks if this player has an account on the server yet This will always return true if the player has joined the server at least once as all major economy plugins auto-generate a player account when the player joins the serverbooleanhasAccount(org.bukkit.OfflinePlayer player, String worldName) Checks if this player has an account on the server yet on the given world This will always return true if the player has joined the server at least once as all major economy plugins auto-generate a player account when the player joins the serverbooleanReturns true if the given implementation supports banks.net.milkbowl.vault.economy.EconomyResponseisBankMember(String name, String playerName) Deprecated.As of VaultAPI 1.4 use {isBankMember(String, OfflinePlayer)instead.net.milkbowl.vault.economy.EconomyResponseisBankMember(String name, org.bukkit.OfflinePlayer player) Check if the player is a member of the bank accountnet.milkbowl.vault.economy.EconomyResponseisBankOwner(String name, String playerName) Deprecated.As of VaultAPI 1.4 use {isBankOwner(String, OfflinePlayer)instead.net.milkbowl.vault.economy.EconomyResponseisBankOwner(String name, org.bukkit.OfflinePlayer player) Check if a player is the owner of a bank accountbooleanChecks if economy method is enabled.voidreloadConfiguration(@NotNull Configuration configuration) Called when the configuration is reloaded.net.milkbowl.vault.economy.EconomyResponsewithdrawPlayer(String playerName, double amount) Deprecated.As of VaultAPI 1.4 usewithdrawPlayer(OfflinePlayer, double)instead.net.milkbowl.vault.economy.EconomyResponsewithdrawPlayer(String playerName, String worldName, double amount) Deprecated.As of VaultAPI 1.4 usewithdrawPlayer(OfflinePlayer, String, double)instead.net.milkbowl.vault.economy.EconomyResponsewithdrawPlayer(org.bukkit.OfflinePlayer player, double amount) Withdraw an amount from a player - DO NOT USE NEGATIVE AMOUNTSnet.milkbowl.vault.economy.EconomyResponsewithdrawPlayer(org.bukkit.OfflinePlayer player, String worldName, double amount) Withdraw an amount from a player on a given world - DO NOT USE NEGATIVE AMOUNTS IMPLEMENTATION SPECIFIC - if an economy plugin does not support this the global balance will be returned.
-
Constructor Details
-
ExperienceEconomy
public ExperienceEconomy(org.bukkit.plugin.Plugin plugin, AccountManager accountManager, Configuration configuration) Creates a new instance of the Economy class.- Parameters:
plugin- The parent plugin instance.accountManager- The account manager instance.
-
-
Method Details
-
reloadConfiguration
Called when the configuration is reloaded. Sets the state of the consumer based on the new configuration.- Specified by:
reloadConfigurationin interfaceConfigurationConsumer- Parameters:
configuration- The configuration.
-
isEnabled
public boolean isEnabled()Checks if economy method is enabled.- Specified by:
isEnabledin interfacenet.milkbowl.vault.economy.Economy- Returns:
- Success or Failure
-
getName
Gets name of economy method- Specified by:
getNamein interfacenet.milkbowl.vault.economy.Economy- Returns:
- Name of Economy Method
-
hasBankSupport
public boolean hasBankSupport()Returns true if the given implementation supports banks.- Specified by:
hasBankSupportin interfacenet.milkbowl.vault.economy.Economy- Returns:
- true if the implementation supports banks
-
fractionalDigits
public int fractionalDigits()Some economy plugins round off after a certain number of digits. This function returns the number of digits the plugin keeps or -1 if no rounding occurs.- Specified by:
fractionalDigitsin interfacenet.milkbowl.vault.economy.Economy- Returns:
- number of digits after the decimal point kept
-
format
Format amount into a human readable String This provides translation into economy specific formatting to improve consistency between plugins.- Specified by:
formatin interfacenet.milkbowl.vault.economy.Economy- Parameters:
amount- to format- Returns:
- Human readable string describing amount
-
currencyNamePlural
Returns the name of the currency in plural form. If the economy being used does not support currency names then an empty string will be returned.- Specified by:
currencyNamePluralin interfacenet.milkbowl.vault.economy.Economy- Returns:
- name of the currency (plural)
-
currencyNameSingular
Returns the name of the currency in singular form. If the economy being used does not support currency names then an empty string will be returned.- Specified by:
currencyNameSingularin interfacenet.milkbowl.vault.economy.Economy- Returns:
- name of the currency (singular)
-
hasAccount
Deprecated.As of VaultAPI 1.4 usehasAccount(OfflinePlayer)instead.Checks if this player has an account on the server yet This will always return true if the player has joined the server at least once as all major economy plugins auto-generate a player account when the player joins the server- Specified by:
hasAccountin interfacenet.milkbowl.vault.economy.Economy- Parameters:
playerName- The name of the player.
-
hasAccount
public boolean hasAccount(org.bukkit.OfflinePlayer player) Checks if this player has an account on the server yet This will always return true if the player has joined the server at least once as all major economy plugins auto-generate a player account when the player joins the server- Specified by:
hasAccountin interfacenet.milkbowl.vault.economy.Economy- Parameters:
player- to check- Returns:
- if the player has an account
-
hasAccount
Deprecated.As of VaultAPI 1.4 usehasAccount(OfflinePlayer, String)instead.Checks if this player has an account on the server yet This will always return true if the player has joined the server at least once as all major economy plugins auto-generate a player account when the player joins the server- Specified by:
hasAccountin interfacenet.milkbowl.vault.economy.Economy- Parameters:
playerName- to check in the worldworldName- world-specific account- Returns:
- if the player has an account
-
hasAccount
Checks if this player has an account on the server yet on the given world This will always return true if the player has joined the server at least once as all major economy plugins auto-generate a player account when the player joins the server- Specified by:
hasAccountin interfacenet.milkbowl.vault.economy.Economy- Parameters:
player- to check in the worldworldName- world-specific account- Returns:
- if the player has an account
-
getBalance
Deprecated.As of VaultAPI 1.4 usegetBalance(OfflinePlayer)instead.Gets balance of a player- Specified by:
getBalancein interfacenet.milkbowl.vault.economy.Economy- Parameters:
playerName- The player name.- Returns:
- Amount currently held in players account
-
getBalance
public double getBalance(org.bukkit.OfflinePlayer player) Gets balance of a player- Specified by:
getBalancein interfacenet.milkbowl.vault.economy.Economy- Parameters:
player- of the player- Returns:
- Amount currently held in players account
-
getBalance
Deprecated.As of VaultAPI 1.4 usegetBalance(OfflinePlayer, String)instead.- Specified by:
getBalancein interfacenet.milkbowl.vault.economy.Economy- Parameters:
playerName- The player nameworld- The name of the world.- Returns:
- Amount currently held in players account
-
getBalance
Gets balance of a player on the specified world. IMPLEMENTATION SPECIFIC - if an economy plugin does not support this the global balance will be returned.- Specified by:
getBalancein interfacenet.milkbowl.vault.economy.Economy- Parameters:
player- to checkworld- name of the world- Returns:
- Amount currently held in players account
-
has
Deprecated.As of VaultAPI 1.4 usehas(OfflinePlayer, double)instead.- Specified by:
hasin interfacenet.milkbowl.vault.economy.Economy- Parameters:
playerName- to checkamount- to check for
-
has
public boolean has(org.bukkit.OfflinePlayer player, double amount) Checks if the player account has the amount - DO NOT USE NEGATIVE AMOUNTS- Specified by:
hasin interfacenet.milkbowl.vault.economy.Economy- Parameters:
player- to checkamount- to check for- Returns:
- True if player has amount, False else wise
-
has
Deprecated.As of VaultAPI 1.4 use @{linkhas(OfflinePlayer, String, double)instead.- Specified by:
hasin interfacenet.milkbowl.vault.economy.Economy- Parameters:
playerName- to checkworldName- to check withamount- to check for
-
has
Checks if the player account has the amount in a given world - DO NOT USE NEGATIVE AMOUNTS IMPLEMENTATION SPECIFIC - if an economy plugin does not support this the global balance will be returned.- Specified by:
hasin interfacenet.milkbowl.vault.economy.Economy- Parameters:
player- to checkworldName- to check withamount- to check for- Returns:
- True if player has amount, False else wise
-
withdrawPlayer
@Deprecated public net.milkbowl.vault.economy.EconomyResponse withdrawPlayer(String playerName, double amount) Deprecated.As of VaultAPI 1.4 usewithdrawPlayer(OfflinePlayer, double)instead.Withdraw an amount from a player - DO NOT USE NEGATIVE AMOUNTS- Specified by:
withdrawPlayerin interfacenet.milkbowl.vault.economy.Economy- Parameters:
playerName- to checkamount- to check for
-
withdrawPlayer
public net.milkbowl.vault.economy.EconomyResponse withdrawPlayer(org.bukkit.OfflinePlayer player, double amount) Withdraw an amount from a player - DO NOT USE NEGATIVE AMOUNTS- Specified by:
withdrawPlayerin interfacenet.milkbowl.vault.economy.Economy- Parameters:
player- to withdraw fromamount- Amount to withdraw- Returns:
- Detailed response of transaction
-
withdrawPlayer
@Deprecated public net.milkbowl.vault.economy.EconomyResponse withdrawPlayer(String playerName, String worldName, double amount) Deprecated.As of VaultAPI 1.4 usewithdrawPlayer(OfflinePlayer, String, double)instead.Withdraw an amount from a player on a given world - DO NOT USE NEGATIVE AMOUNTS IMPLEMENTATION SPECIFIC - if an economy plugin does not support this the global balance will be returned.- Specified by:
withdrawPlayerin interfacenet.milkbowl.vault.economy.Economy- Parameters:
playerName- to withdraw fromworldName- name of the worldamount- amount to withdraw
-
withdrawPlayer
public net.milkbowl.vault.economy.EconomyResponse withdrawPlayer(org.bukkit.OfflinePlayer player, String worldName, double amount) Withdraw an amount from a player on a given world - DO NOT USE NEGATIVE AMOUNTS IMPLEMENTATION SPECIFIC - if an economy plugin does not support this the global balance will be returned.- Specified by:
withdrawPlayerin interfacenet.milkbowl.vault.economy.Economy- Parameters:
player- to withdraw fromworldName- - name of the worldamount- Amount to withdraw- Returns:
- Detailed response of transaction
-
depositPlayer
@Deprecated public net.milkbowl.vault.economy.EconomyResponse depositPlayer(String playerName, double amount) Deprecated.As of VaultAPI 1.4 usedepositPlayer(OfflinePlayer, double)instead.Deposit an amount to a player - DO NOT USE NEGATIVE AMOUNTS- Specified by:
depositPlayerin interfacenet.milkbowl.vault.economy.Economy- Parameters:
playerName- to deposit toamount- amount ot deposit
-
depositPlayer
public net.milkbowl.vault.economy.EconomyResponse depositPlayer(org.bukkit.OfflinePlayer player, double amount) Deposit an amount to a player - DO NOT USE NEGATIVE AMOUNTS- Specified by:
depositPlayerin interfacenet.milkbowl.vault.economy.Economy- Parameters:
player- to deposit toamount- Amount to deposit- Returns:
- Detailed response of transaction
-
depositPlayer
@Deprecated public net.milkbowl.vault.economy.EconomyResponse depositPlayer(String playerName, String worldName, double amount) Deprecated.As of VaultAPI 1.4 usedepositPlayer(OfflinePlayer, String, double)instead.- Specified by:
depositPlayerin interfacenet.milkbowl.vault.economy.Economy- Parameters:
playerName- to checkworldName- to useamount- to deposit
-
depositPlayer
public net.milkbowl.vault.economy.EconomyResponse depositPlayer(org.bukkit.OfflinePlayer player, String worldName, double amount) Deposit an amount to a player - DO NOT USE NEGATIVE AMOUNTS IMPLEMENTATION SPECIFIC - if an economy plugin does not support this the global balance will be returned.- Specified by:
depositPlayerin interfacenet.milkbowl.vault.economy.Economy- Parameters:
player- to deposit toworldName- name of the worldamount- Amount to deposit- Returns:
- Detailed response of transaction
-
createBank
@Deprecated public net.milkbowl.vault.economy.EconomyResponse createBank(String name, String player) Deprecated.As of VaultAPI 1.4 use {createBank(String, OfflinePlayer)instead.Creates a bank account with the specified name and the player as the owner- Specified by:
createBankin interfacenet.milkbowl.vault.economy.Economy- Parameters:
name- to useplayer- to use
-
createBank
public net.milkbowl.vault.economy.EconomyResponse createBank(String name, org.bukkit.OfflinePlayer player) Creates a bank account with the specified name and the player as the owner- Specified by:
createBankin interfacenet.milkbowl.vault.economy.Economy- Parameters:
name- of accountplayer- the account should be linked to- Returns:
- EconomyResponse Object
-
deleteBank
Deletes a bank account with the specified name.- Specified by:
deleteBankin interfacenet.milkbowl.vault.economy.Economy- Parameters:
name- of the back to delete- Returns:
- if the operation completed successfully
-
bankBalance
Returns the amount the bank has- Specified by:
bankBalancein interfacenet.milkbowl.vault.economy.Economy- Parameters:
name- of the account- Returns:
- EconomyResponse Object
-
bankHas
Returns true or false whether the bank has the amount specified - DO NOT USE NEGATIVE AMOUNTS- Specified by:
bankHasin interfacenet.milkbowl.vault.economy.Economy- Parameters:
name- of the accountamount- to check for- Returns:
- EconomyResponse Object
-
bankWithdraw
Withdraw an amount from a bank account - DO NOT USE NEGATIVE AMOUNTS- Specified by:
bankWithdrawin interfacenet.milkbowl.vault.economy.Economy- Parameters:
name- of the accountamount- to withdraw- Returns:
- EconomyResponse Object
-
bankDeposit
Deposit an amount into a bank account - DO NOT USE NEGATIVE AMOUNTS- Specified by:
bankDepositin interfacenet.milkbowl.vault.economy.Economy- Parameters:
name- of the accountamount- to deposit- Returns:
- EconomyResponse Object
-
isBankOwner
@Deprecated public net.milkbowl.vault.economy.EconomyResponse isBankOwner(String name, String playerName) Deprecated.As of VaultAPI 1.4 use {isBankOwner(String, OfflinePlayer)instead.Check if a player is the owner of a bank account- Specified by:
isBankOwnerin interfacenet.milkbowl.vault.economy.Economy- Parameters:
name- of the accountplayerName- to check for ownership
-
isBankOwner
public net.milkbowl.vault.economy.EconomyResponse isBankOwner(String name, org.bukkit.OfflinePlayer player) Check if a player is the owner of a bank account- Specified by:
isBankOwnerin interfacenet.milkbowl.vault.economy.Economy- Parameters:
name- of the accountplayer- to check for ownership- Returns:
- EconomyResponse Object
-
isBankMember
@Deprecated public net.milkbowl.vault.economy.EconomyResponse isBankMember(String name, String playerName) Deprecated.As of VaultAPI 1.4 use {isBankMember(String, OfflinePlayer)instead.Check if the player is a member of the bank account- Specified by:
isBankMemberin interfacenet.milkbowl.vault.economy.Economy- Parameters:
name- of the accountplayerName- to check membership
-
isBankMember
public net.milkbowl.vault.economy.EconomyResponse isBankMember(String name, org.bukkit.OfflinePlayer player) Check if the player is a member of the bank account- Specified by:
isBankMemberin interfacenet.milkbowl.vault.economy.Economy- Parameters:
name- of the accountplayer- to check membership- Returns:
- EconomyResponse Object
-
getBanks
Gets the list of banks- Specified by:
getBanksin interfacenet.milkbowl.vault.economy.Economy- Returns:
- the List of Banks
-
createPlayerAccount
Deprecated.As of VaultAPI 1.4 use {createPlayerAccount(OfflinePlayer)instead.Attempts to create a player account for the given player- Specified by:
createPlayerAccountin interfacenet.milkbowl.vault.economy.Economy- Parameters:
playerName- The player name
-
createPlayerAccount
public boolean createPlayerAccount(org.bukkit.OfflinePlayer player) Attempts to create a player account for the given player- Specified by:
createPlayerAccountin interfacenet.milkbowl.vault.economy.Economy- Parameters:
player- OfflinePlayer- Returns:
- if the account creation was successful
-
createPlayerAccount
Deprecated.As of VaultAPI 1.4 use {createPlayerAccount(OfflinePlayer, String)instead.Attempts to create a player account for the given player on the specified world IMPLEMENTATION SPECIFIC - if an economy plugin does not support this then false will always be returned.- Specified by:
createPlayerAccountin interfacenet.milkbowl.vault.economy.Economy- Parameters:
playerName- player nameworldName- name of the world
-
createPlayerAccount
Attempts to create a player account for the given player on the specified world IMPLEMENTATION SPECIFIC - if an economy plugin does not support this then false will always be returned.- Specified by:
createPlayerAccountin interfacenet.milkbowl.vault.economy.Economy- Parameters:
player- OfflinePlayerworldName- String name of the world- Returns:
- if the account creation was successful
-
createBank(String, OfflinePlayer)instead.