Class ExperienceEconomy

java.lang.Object
dev.satyrn.xpeconomy.economy.ExperienceEconomy
All Implemented Interfaces:
net.milkbowl.vault.economy.Economy

public final class ExperienceEconomy extends Object implements net.milkbowl.vault.economy.Economy
The XP Economy handler.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ExperienceEconomy(org.bukkit.plugin.Plugin plugin, AccountManager accountManager, @NotNull Configuration configuration)
    Creates a new instance of the Economy class.
  • Method Summary

    Modifier and Type
    Method
    Description
    net.milkbowl.vault.economy.EconomyResponse
    Returns the amount the bank has
    net.milkbowl.vault.economy.EconomyResponse
    bankDeposit(String name, double amount)
    Deposit an amount into a bank account - DO NOT USE NEGATIVE AMOUNTS
    net.milkbowl.vault.economy.EconomyResponse
    bankHas(String name, double amount)
    Returns true or false whether the bank has the amount specified - DO NOT USE NEGATIVE AMOUNTS
    net.milkbowl.vault.economy.EconomyResponse
    bankWithdraw(String name, double amount)
    Withdraw an amount from a bank account - DO NOT USE NEGATIVE AMOUNTS
    net.milkbowl.vault.economy.EconomyResponse
    createBank(String name, String player)
    Deprecated.
    As of VaultAPI 1.4 use {createBank(String, OfflinePlayer) instead.
    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
    boolean
    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 player
    boolean
    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
    Deletes a bank account with the specified name.
    net.milkbowl.vault.economy.EconomyResponse
    depositPlayer(String playerName, double amount)
    Deprecated.
    As of VaultAPI 1.4 use depositPlayer(OfflinePlayer, double) instead.
    net.milkbowl.vault.economy.EconomyResponse
    depositPlayer(String playerName, String worldName, double amount)
    Deprecated.
    As of VaultAPI 1.4 use depositPlayer(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 AMOUNTS
    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.
    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 use getBalance(OfflinePlayer) instead.
    double
    getBalance(String playerName, String world)
    Deprecated.
    As of VaultAPI 1.4 use getBalance(OfflinePlayer, String) instead.
    double
    getBalance(org.bukkit.OfflinePlayer player)
    Gets balance of a player
    double
    getBalance(org.bukkit.OfflinePlayer player, String world)
    Gets balance of a player on the specified world.
    Gets the list of banks
    Gets name of economy method
    boolean
    has(String playerName, double amount)
    Deprecated.
    As of VaultAPI 1.4 use has(OfflinePlayer, double) instead.
    boolean
    has(String playerName, String worldName, double amount)
    Deprecated.
    As of VaultAPI 1.4 use has(OfflinePlayer, String, double) instead.
    boolean
    has(org.bukkit.OfflinePlayer player, double amount)
    Checks if the player account has the amount - DO NOT USE NEGATIVE AMOUNTS
    boolean
    has(org.bukkit.OfflinePlayer player, String worldName, double amount)
    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 use hasAccount(OfflinePlayer) instead.
    boolean
    hasAccount(String playerName, String worldName)
    Deprecated.
    As of VaultAPI 1.4 use hasAccount(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 server
    boolean
    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 server
    boolean
    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 account
    net.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 account
    boolean
    Checks if economy method is enabled.
    net.milkbowl.vault.economy.EconomyResponse
    withdrawPlayer(String playerName, double amount)
    Deprecated.
    As of VaultAPI 1.4 use withdrawPlayer(OfflinePlayer, double) instead.
    net.milkbowl.vault.economy.EconomyResponse
    withdrawPlayer(String playerName, String worldName, double amount)
    Deprecated.
    As of VaultAPI 1.4 use withdrawPlayer(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 AMOUNTS
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 interface net.milkbowl.vault.economy.Economy
      Returns:
      Success or Failure
    • getName

      public String getName()
      Gets name of economy method
      Specified by:
      getName in interface net.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 interface net.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 interface net.milkbowl.vault.economy.Economy
      Returns:
      number of digits after the decimal point kept
    • format

      public String format(double amount)
      Format amount into a human-readable String This provides translation into economy specific formatting to improve consistency between plugins.
      Specified by:
      format in interface net.milkbowl.vault.economy.Economy
      Parameters:
      amount - to format
      Returns:
      Human-readable string describing amount
    • currencyNamePlural

      public String 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 interface net.milkbowl.vault.economy.Economy
      Returns:
      name of the currency (plural)
    • currencyNameSingular

      public String 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 interface net.milkbowl.vault.economy.Economy
      Returns:
      name of the currency (singular)
    • hasAccount

      @Deprecated public boolean hasAccount(String playerName)
      Deprecated.
      As of VaultAPI 1.4 use hasAccount(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 interface net.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 interface net.milkbowl.vault.economy.Economy
      Parameters:
      player - to check
      Returns:
      if the player has an account
    • hasAccount

      @Deprecated public boolean hasAccount(String playerName, String worldName)
      Deprecated.
      As of VaultAPI 1.4 use hasAccount(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 interface net.milkbowl.vault.economy.Economy
      Parameters:
      playerName - to check in the world
      worldName - world-specific account
      Returns:
      if the player has an account
    • hasAccount

      public boolean 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 server
      Specified by:
      hasAccount in interface net.milkbowl.vault.economy.Economy
      Parameters:
      player - to check in the world
      worldName - world-specific account
      Returns:
      if the player has an account
    • getBalance

      @Deprecated public double getBalance(String playerName)
      Deprecated.
      As of VaultAPI 1.4 use getBalance(OfflinePlayer) instead.
      Gets balance of a player
      Specified by:
      getBalance in interface net.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 interface net.milkbowl.vault.economy.Economy
      Parameters:
      player - of the player
      Returns:
      Amount currently held in players account
    • getBalance

      @Deprecated public double getBalance(String playerName, String world)
      Deprecated.
      As of VaultAPI 1.4 use getBalance(OfflinePlayer, String) instead.
      Specified by:
      getBalance in interface net.milkbowl.vault.economy.Economy
      Parameters:
      playerName - The player name
      world - The name of the world.
      Returns:
      Amount currently held in players account
    • getBalance

      public double getBalance(org.bukkit.OfflinePlayer player, String world)
      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 interface net.milkbowl.vault.economy.Economy
      Parameters:
      player - to check
      world - name of the world
      Returns:
      Amount currently held in players account
    • has

      @Deprecated public boolean has(String playerName, double amount)
      Deprecated.
      As of VaultAPI 1.4 use has(OfflinePlayer, double) instead.
      Specified by:
      has in interface net.milkbowl.vault.economy.Economy
      Parameters:
      playerName - to check
      amount - 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 interface net.milkbowl.vault.economy.Economy
      Parameters:
      player - to check
      amount - to check for
      Returns:
      True if player has amount, False else wise
    • has

      @Deprecated public boolean has(String playerName, String worldName, double amount)
      Deprecated.
      As of VaultAPI 1.4 use has(OfflinePlayer, String, double) instead.
      Specified by:
      has in interface net.milkbowl.vault.economy.Economy
      Parameters:
      playerName - to check
      worldName - to check with
      amount - to check for
    • has

      public boolean has(org.bukkit.OfflinePlayer player, String worldName, double amount)
      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 interface net.milkbowl.vault.economy.Economy
      Parameters:
      player - to check
      worldName - to check with
      amount - 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 use withdrawPlayer(OfflinePlayer, double) instead.
      Withdraw an amount from a player - DO NOT USE NEGATIVE AMOUNTS
      Specified by:
      withdrawPlayer in interface net.milkbowl.vault.economy.Economy
      Parameters:
      playerName - to check
      amount - 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 interface net.milkbowl.vault.economy.Economy
      Parameters:
      player - to withdraw from
      amount - 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 use withdrawPlayer(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 interface net.milkbowl.vault.economy.Economy
      Parameters:
      playerName - to withdraw from
      worldName - name of the world
      amount - 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 interface net.milkbowl.vault.economy.Economy
      Parameters:
      player - to withdraw from
      worldName - - name of the world
      amount - 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 use depositPlayer(OfflinePlayer, double) instead.
      Deposit an amount to a player - DO NOT USE NEGATIVE AMOUNTS
      Specified by:
      depositPlayer in interface net.milkbowl.vault.economy.Economy
      Parameters:
      playerName - to deposit to
      amount - 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 interface net.milkbowl.vault.economy.Economy
      Parameters:
      player - to deposit to
      amount - 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 use depositPlayer(OfflinePlayer, String, double) instead.
      Specified by:
      depositPlayer in interface net.milkbowl.vault.economy.Economy
      Parameters:
      playerName - to check
      worldName - to use
      amount - 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 interface net.milkbowl.vault.economy.Economy
      Parameters:
      player - to deposit to
      worldName - name of the world
      amount - 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 interface net.milkbowl.vault.economy.Economy
      Parameters:
      name - to use
      player - 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 interface net.milkbowl.vault.economy.Economy
      Parameters:
      name - of account
      player - the account should be linked to
      Returns:
      EconomyResponse Object
    • deleteBank

      public net.milkbowl.vault.economy.EconomyResponse deleteBank(String name)
      Deletes a bank account with the specified name.
      Specified by:
      deleteBank in interface net.milkbowl.vault.economy.Economy
      Parameters:
      name - of the back to delete
      Returns:
      if the operation completed successfully
    • bankBalance

      public net.milkbowl.vault.economy.EconomyResponse bankBalance(String name)
      Returns the amount the bank has
      Specified by:
      bankBalance in interface net.milkbowl.vault.economy.Economy
      Parameters:
      name - of the account
      Returns:
      EconomyResponse Object
    • bankHas

      public net.milkbowl.vault.economy.EconomyResponse bankHas(String name, double amount)
      Returns true or false whether the bank has the amount specified - DO NOT USE NEGATIVE AMOUNTS
      Specified by:
      bankHas in interface net.milkbowl.vault.economy.Economy
      Parameters:
      name - of the account
      amount - to check for
      Returns:
      EconomyResponse Object
    • bankWithdraw

      public net.milkbowl.vault.economy.EconomyResponse bankWithdraw(String name, double amount)
      Withdraw an amount from a bank account - DO NOT USE NEGATIVE AMOUNTS
      Specified by:
      bankWithdraw in interface net.milkbowl.vault.economy.Economy
      Parameters:
      name - of the account
      amount - to withdraw
      Returns:
      EconomyResponse Object
    • bankDeposit

      public net.milkbowl.vault.economy.EconomyResponse bankDeposit(String name, double amount)
      Deposit an amount into a bank account - DO NOT USE NEGATIVE AMOUNTS
      Specified by:
      bankDeposit in interface net.milkbowl.vault.economy.Economy
      Parameters:
      name - of the account
      amount - 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 interface net.milkbowl.vault.economy.Economy
      Parameters:
      name - of the account
      playerName - 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 interface net.milkbowl.vault.economy.Economy
      Parameters:
      name - of the account
      player - 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 interface net.milkbowl.vault.economy.Economy
      Parameters:
      name - of the account
      playerName - 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 interface net.milkbowl.vault.economy.Economy
      Parameters:
      name - of the account
      player - to check membership
      Returns:
      EconomyResponse Object
    • getBanks

      public List<String> getBanks()
      Gets the list of banks
      Specified by:
      getBanks in interface net.milkbowl.vault.economy.Economy
      Returns:
      the List of Banks
    • createPlayerAccount

      @Deprecated public boolean createPlayerAccount(String playerName)
      Deprecated.
      As of VaultAPI 1.4 use {createPlayerAccount(OfflinePlayer) instead.
      Attempts to create a player account for the given player
      Specified by:
      createPlayerAccount in interface net.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 interface net.milkbowl.vault.economy.Economy
      Parameters:
      player - OfflinePlayer
      Returns:
      if the account creation was successful
    • createPlayerAccount

      @Deprecated public boolean createPlayerAccount(String playerName, String worldName)
      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 interface net.milkbowl.vault.economy.Economy
      Parameters:
      playerName - player name
      worldName - name of the world
    • createPlayerAccount

      public boolean 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.
      Specified by:
      createPlayerAccount in interface net.milkbowl.vault.economy.Economy
      Parameters:
      player - OfflinePlayer
      worldName - String name of the world
      Returns:
      if the account creation was successful