Package dev.satyrn.xpeconomy.economy
Class ExperienceEconomy
java.lang.Object
dev.satyrn.xpeconomy.economy.ExperienceEconomy
- All Implemented Interfaces:
net.milkbowl.vault.economy.Economy
The XP Economy handler.
-
Constructor Summary
ConstructorDescriptionExperienceEconomy
(org.bukkit.plugin.Plugin plugin, AccountManager accountManager, @NotNull Configuration configuration) Creates a new instance of the Economy class. -
Method Summary
Modifier and TypeMethodDescriptionnet.milkbowl.vault.economy.EconomyResponse
bankBalance
(String name) Returns the amount the bank hasnet.milkbowl.vault.economy.EconomyResponse
bankDeposit
(String name, double amount) Deposit an amount into a bank account - DO NOT USE NEGATIVE AMOUNTSnet.milkbowl.vault.economy.EconomyResponse
Returns true or false whether the bank has the amount specified - DO NOT USE NEGATIVE AMOUNTSnet.milkbowl.vault.economy.EconomyResponse
bankWithdraw
(String name, double amount) Withdraw an amount from a bank account - DO NOT USE NEGATIVE AMOUNTSnet.milkbowl.vault.economy.EconomyResponse
createBank
(String name, String player) Deprecated.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 ownerboolean
createPlayerAccount
(String playerName) Deprecated.As of VaultAPI 1.4 use {createPlayerAccount(OfflinePlayer)
instead.boolean
createPlayerAccount
(String playerName, String worldName) Deprecated.As of VaultAPI 1.4 use {createPlayerAccount(OfflinePlayer, String)
instead.boolean
createPlayerAccount
(org.bukkit.OfflinePlayer player) Attempts to create a player account for the given playerboolean
createPlayerAccount
(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.EconomyResponse
deleteBank
(String name) Deletes a bank account with the specified name.net.milkbowl.vault.economy.EconomyResponse
depositPlayer
(String playerName, double amount) Deprecated.As of VaultAPI 1.4 usedepositPlayer(OfflinePlayer, double)
instead.net.milkbowl.vault.economy.EconomyResponse
depositPlayer
(String playerName, String worldName, double amount) Deprecated.As of VaultAPI 1.4 usedepositPlayer(OfflinePlayer, String, double)
instead.net.milkbowl.vault.economy.EconomyResponse
depositPlayer
(org.bukkit.OfflinePlayer player, double amount) Deposit an amount to a player - DO NOT USE NEGATIVE AMOUNTSnet.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.format
(double amount) Format amount into a human-readable String This provides translation into economy specific formatting to improve consistency between plugins.int
Some economy plugins round off after a certain number of digits.double
getBalance
(String playerName) Deprecated.As of VaultAPI 1.4 usegetBalance(OfflinePlayer)
instead.double
getBalance
(String playerName, String world) Deprecated.As of VaultAPI 1.4 usegetBalance(OfflinePlayer, String)
instead.double
getBalance
(org.bukkit.OfflinePlayer player) Gets balance of a playerdouble
getBalance
(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 methodboolean
Deprecated.As of VaultAPI 1.4 usehas(OfflinePlayer, double)
instead.boolean
Deprecated.As of VaultAPI 1.4 usehas(OfflinePlayer, String, double)
instead.boolean
has
(org.bukkit.OfflinePlayer player, double amount) Checks if the player account has the amount - DO NOT USE NEGATIVE AMOUNTSboolean
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.boolean
hasAccount
(String playerName) Deprecated.As of VaultAPI 1.4 usehasAccount(OfflinePlayer)
instead.boolean
hasAccount
(String playerName, String worldName) Deprecated.As of VaultAPI 1.4 usehasAccount(OfflinePlayer, String)
instead.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 serverboolean
hasAccount
(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 serverboolean
Returns true if the given implementation supports banks.net.milkbowl.vault.economy.EconomyResponse
isBankMember
(String name, String playerName) Deprecated.As of VaultAPI 1.4 use {isBankMember(String, OfflinePlayer)
instead.net.milkbowl.vault.economy.EconomyResponse
isBankMember
(String name, org.bukkit.OfflinePlayer player) Check if the player is a member of the bank accountnet.milkbowl.vault.economy.EconomyResponse
isBankOwner
(String name, String playerName) Deprecated.As of VaultAPI 1.4 use {isBankOwner(String, OfflinePlayer)
instead.net.milkbowl.vault.economy.EconomyResponse
isBankOwner
(String name, org.bukkit.OfflinePlayer player) Check if a player is the owner of a bank accountboolean
Checks if economy method is enabled.net.milkbowl.vault.economy.EconomyResponse
withdrawPlayer
(String playerName, double amount) Deprecated.As of VaultAPI 1.4 usewithdrawPlayer(OfflinePlayer, double)
instead.net.milkbowl.vault.economy.EconomyResponse
withdrawPlayer
(String playerName, String worldName, double amount) Deprecated.As of VaultAPI 1.4 usewithdrawPlayer(OfflinePlayer, String, double)
instead.net.milkbowl.vault.economy.EconomyResponse
withdrawPlayer
(org.bukkit.OfflinePlayer player, double amount) Withdraw an amount from a player - DO NOT USE NEGATIVE AMOUNTSnet.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.
-
Constructor Details
-
ExperienceEconomy
public ExperienceEconomy(org.bukkit.plugin.Plugin plugin, AccountManager accountManager, @NotNull @NotNull Configuration configuration) Creates a new instance of the Economy class.- Parameters:
plugin
- The parent plugin instance.accountManager
- The account manager instance.
-
-
Method Details
-
isEnabled
public boolean isEnabled()Checks if economy method is enabled.- Specified by:
isEnabled
in interfacenet.milkbowl.vault.economy.Economy
- Returns:
- Success or Failure
-
getName
Gets name of economy method- Specified by:
getName
in interfacenet.milkbowl.vault.economy.Economy
- Returns:
- Name of Economy Method
-
hasBankSupport
public boolean hasBankSupport()Returns true if the given implementation supports banks.- Specified by:
hasBankSupport
in 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:
fractionalDigits
in 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:
format
in 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:
currencyNamePlural
in 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:
currencyNameSingular
in 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:
hasAccount
in 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:
hasAccount
in 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:
hasAccount
in 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:
hasAccount
in 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:
getBalance
in 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:
getBalance
in 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:
getBalance
in 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:
getBalance
in 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:
has
in 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:
has
in 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 usehas(OfflinePlayer, String, double)
instead.- Specified by:
has
in 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:
has
in 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:
withdrawPlayer
in 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:
withdrawPlayer
in 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:
withdrawPlayer
in 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:
withdrawPlayer
in 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:
depositPlayer
in 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:
depositPlayer
in 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:
depositPlayer
in 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:
depositPlayer
in 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:
createBank
in 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:
createBank
in 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:
deleteBank
in 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:
bankBalance
in 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:
bankHas
in 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:
bankWithdraw
in 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:
bankDeposit
in 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:
isBankOwner
in 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:
isBankOwner
in 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:
isBankMember
in 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:
isBankMember
in interfacenet.milkbowl.vault.economy.Economy
- Parameters:
name
- of the accountplayer
- to check membership- Returns:
- EconomyResponse Object
-
getBanks
Gets the list of banks- Specified by:
getBanks
in 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:
createPlayerAccount
in 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:
createPlayerAccount
in 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:
createPlayerAccount
in 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:
createPlayerAccount
in interfacenet.milkbowl.vault.economy.Economy
- Parameters:
player
- OfflinePlayerworldName
- String name of the world- Returns:
- if the account creation was successful
-
createBank(String, OfflinePlayer)
instead.