mirror of https://github.com/MilkBowl/VaultAPI.git
VaultAPI2 should now be compatible with legacy plugins.
We now need Vault2 (the one that's available at runtime as a plugin) to implement this API. The idea for Vault2 is that it will detect if a legacy economy is registered. If so, it will also register its IdentityEconomy provider. The idea of IdentityEconomy is to support UUIDs.
This commit is contained in:
parent
19801e59c9
commit
243509cbc6
|
@ -203,7 +203,7 @@ public class ExamplePlugin extends JavaPlugin {
|
|||
public static Permission getPermissions() {
|
||||
return perms;
|
||||
}
|
||||
|
||||
|
||||
public static Chat getChat() {
|
||||
return chat;
|
||||
}
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -3,7 +3,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>net.milkbowl.vault</groupId>
|
||||
<artifactId>vaultapi</artifactId>
|
||||
<version>2.0-SNAPSHOT</version>
|
||||
<version>2.2-SNAPSHOT</version>
|
||||
|
||||
<name>VaultAPI</name>
|
||||
<description>Vault is a Permissions & Economy API to allow plugins to more easily hook into these systems without needing to hook each individual system themselves.
|
||||
|
|
|
@ -16,11 +16,9 @@
|
|||
|
||||
package net.milkbowl.vault.economy;
|
||||
|
||||
import org.bukkit.OfflinePlayer;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.OfflinePlayer;
|
||||
|
||||
/**
|
||||
* The main economy API
|
||||
|
@ -29,36 +27,27 @@ import java.util.UUID;
|
|||
public interface Economy {
|
||||
|
||||
/**
|
||||
* Checks if economy method/implementation is enabled.
|
||||
*
|
||||
* Checks if economy method is enabled.
|
||||
* @return Success or Failure
|
||||
*/
|
||||
public boolean isEnabled();
|
||||
|
||||
/**
|
||||
* Gets name of economy method or implementation
|
||||
* in case of being used in multi-currency environment.
|
||||
*
|
||||
* Gets name of economy method
|
||||
* @return Name of Economy Method
|
||||
*/
|
||||
public String getName();
|
||||
|
||||
/**
|
||||
* Returns true if the given implementation supports banks.
|
||||
*
|
||||
* @return true if the implementation supports banks
|
||||
*/
|
||||
public boolean hasBankSupport();
|
||||
|
||||
/*
|
||||
* Currency-related methods follow.
|
||||
*/
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* 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.
|
||||
* @return number of digits after the decimal point kept
|
||||
*/
|
||||
public int fractionalDigits();
|
||||
|
@ -73,80 +62,22 @@ public interface Economy {
|
|||
public String format(double amount);
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @return name of the currency (plural)
|
||||
*/
|
||||
public String currencyNamePlural();
|
||||
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @return name of the currency (singular)
|
||||
*/
|
||||
public String currencyNameSingular();
|
||||
|
||||
/*
|
||||
* Account-related methods follow.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Attempts to create a account for the given uuid
|
||||
*
|
||||
* @param uuid associated with the account
|
||||
* @param name associated with the account.
|
||||
* @return if the account creation was successful
|
||||
*/
|
||||
public boolean createAccount(UUID uuid, String name);
|
||||
|
||||
/**
|
||||
* Attempts to create an account for the given UUID on the specified world
|
||||
* IMPLEMENTATION SPECIFIC - if an economy plugin does not support this then
|
||||
* false will always be returned.
|
||||
*
|
||||
* @param uuid associated with the account
|
||||
* @param name associated with the account.
|
||||
* @param worldName String name of the world
|
||||
* @return if the account creation was successful
|
||||
*/
|
||||
public boolean createAccount(UUID uuid, String name, String worldName);
|
||||
|
||||
/**
|
||||
* Returns a map that represents all of the UUIDs which have accounts in the
|
||||
* plugin, as well as their last-known-name. This is used for Vault's economy
|
||||
* converter and should be given every account available.
|
||||
*
|
||||
* @return a {@link Map} composed of the accounts keyed by their UUID, along
|
||||
* with their associated last-known-name.
|
||||
*/
|
||||
public Map<UUID, String> getUUIDNameMap();
|
||||
|
||||
/**
|
||||
* Gets the last known name of an account owned by the given UUID. Required for
|
||||
* messages to be more human-readable than UUIDs alone can provide.
|
||||
*
|
||||
* @param uuid UUID to look up.
|
||||
*/
|
||||
public String getAccountName(UUID uuid);
|
||||
|
||||
/**
|
||||
* Checks if this uuid has an account yet
|
||||
*
|
||||
* @param uuid to check
|
||||
* @return if the uuid has an account
|
||||
*/
|
||||
public boolean hasAccount(UUID uuid);
|
||||
|
||||
/**
|
||||
* Checks if this player has an account yet
|
||||
* @param player to check
|
||||
*/
|
||||
public default boolean hasAccount(OfflinePlayer player){
|
||||
return hasAccount(player.getUniqueId());
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated As of VaultAPI 1.4 use {@link #hasAccount(OfflinePlayer)} instead.
|
||||
|
@ -155,302 +86,172 @@ public interface Economy {
|
|||
public boolean hasAccount(String playerName);
|
||||
|
||||
/**
|
||||
* Checks if this uuid has an account yet on the given world
|
||||
*
|
||||
* @param uuid to check
|
||||
* @param worldName world-specific account
|
||||
* @return if the uuid has an account
|
||||
*/
|
||||
public boolean hasAccount(UUID uuid, String worldName);
|
||||
|
||||
/**
|
||||
* Checks if this player has an account yet on the given world
|
||||
* @param player to check
|
||||
* @param worldName world-specific account
|
||||
*/
|
||||
public default boolean hasAccount(OfflinePlayer player, String worldName){
|
||||
return hasAccount(player.getUniqueId(), worldName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
* @param player to check
|
||||
* @return if the player has an account
|
||||
*/
|
||||
public boolean hasAccount(OfflinePlayer player);
|
||||
|
||||
/**
|
||||
* @deprecated As of VaultAPI 1.4 use {@link #hasAccount(OfflinePlayer, String)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean hasAccount(String playerName, String worldName);
|
||||
|
||||
/**
|
||||
* A method which changes the name associated with the given UUID in the
|
||||
* Map<UUID, String> received from {@link #getUUIDNameMap()}.
|
||||
*
|
||||
* @param uuid which is having a name change.
|
||||
* @param name name that will be associated with the UUID in the
|
||||
* Map<UUID, String> map.
|
||||
* @return true if the name change is successful.
|
||||
*/
|
||||
public boolean renameAccount(UUID uuid, String name);
|
||||
|
||||
/**
|
||||
* Gets balance of a UUID
|
||||
*
|
||||
* @param uuid of the account to get a balance for
|
||||
* @return Amount currently held in account associated with the given UUID
|
||||
*/
|
||||
public double getBalance(UUID uuid);
|
||||
|
||||
/**
|
||||
* Gets balance of a player
|
||||
* @param player to check
|
||||
*/
|
||||
public default double getBalance(OfflinePlayer player){
|
||||
return getBalance(player.getUniqueId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
* @param player to check in the world
|
||||
* @param worldName world-specific account
|
||||
* @return if the player has an account
|
||||
*/
|
||||
public boolean hasAccount(OfflinePlayer player, String worldName);
|
||||
|
||||
/**
|
||||
* @deprecated As of VaultAPI 1.4 use {@link #getBalance(OfflinePlayer)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public double getBalance(String playerName);
|
||||
|
||||
/**
|
||||
* Gets balance of a UUID on the specified world. IMPLEMENTATION SPECIFIC - if
|
||||
* an economy plugin does not support this the global balance will be returned.
|
||||
*
|
||||
* @param uuid of the account to get a balance for
|
||||
* @param world name of the world
|
||||
* @return Amount currently held in account associated with the given UUID
|
||||
*/
|
||||
public double getBalance(UUID uuid, 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.
|
||||
* @param player to check
|
||||
* @param world name of the world
|
||||
*/
|
||||
public default double getBalance(OfflinePlayer player, String world){
|
||||
return getBalance(player.getUniqueId(), world);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets balance of a player
|
||||
*
|
||||
* @param player of the player
|
||||
* @return Amount currently held in players account
|
||||
*/
|
||||
public double getBalance(OfflinePlayer player);
|
||||
|
||||
/**
|
||||
* @deprecated As of VaultAPI 1.4 use {@link #getBalance(OfflinePlayer, String)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public double getBalance(String playerName, String world);
|
||||
|
||||
/**
|
||||
* Checks if the account associated with the given UUID has the amount - DO NOT
|
||||
* USE NEGATIVE AMOUNTS
|
||||
*
|
||||
* @param uuid to check
|
||||
* @param amount to check for
|
||||
* @return True if <b>UUID</b> has <b>amount</b>, False else wise
|
||||
*/
|
||||
public boolean has(UUID uuid, double amount);
|
||||
|
||||
/**
|
||||
* Checks if the account associated with the given player has the amount - DO NOT
|
||||
* USE NEGATIVE AMOUNTS
|
||||
* 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.
|
||||
* @param player to check
|
||||
* @param amount to check for
|
||||
* @param world name of the world
|
||||
* @return Amount currently held in players account
|
||||
*/
|
||||
public default boolean has(OfflinePlayer player, double amount){
|
||||
return has(player.getUniqueId(), amount);
|
||||
}
|
||||
public double getBalance(OfflinePlayer player, String world);
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated As of VaultAPI 1.4 use {@link #has(OfflinePlayer, double)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean has(String playerName, double amount);
|
||||
|
||||
/**
|
||||
* Checks if the account associated with the given UUID has the amount in the
|
||||
* given world - DO NOT USE NEGATIVE AMOUNTS IMPLEMENTATION SPECIFIC - if an
|
||||
* economy plugin does not support this the global balance will be returned.
|
||||
*
|
||||
* @param uuid to check
|
||||
* @param worldName to check with
|
||||
* @param amount to check for
|
||||
* @return True if <b>UUID</b> has <b>amount</b> in the given <b>world</b>,
|
||||
* False else wise
|
||||
*/
|
||||
public boolean has(UUID uuid, String worldName, double amount);
|
||||
|
||||
/**
|
||||
* Checks if the account associated with the given player has the amount in the
|
||||
* given world - DO NOT USE NEGATIVE AMOUNTS IMPLEMENTATION SPECIFIC - if an
|
||||
* economy plugin does not support this the global balance will be returned.
|
||||
* @param player to check
|
||||
* @param worldName to check with
|
||||
* @param amount to check for
|
||||
*/
|
||||
public default boolean has(OfflinePlayer player, String worldName, double amount){
|
||||
return has(player.getUniqueId(), worldName, amount);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the player account has the amount - DO NOT USE NEGATIVE AMOUNTS
|
||||
*
|
||||
* @deprecated As of VaultAPI 1.4 use {@link #has(OfflinePlayer, String, double)} instead.
|
||||
* @param player to check
|
||||
* @param amount to check for
|
||||
* @return True if <b>player</b> has <b>amount</b>, False else wise
|
||||
*/
|
||||
public boolean has(OfflinePlayer player, double amount);
|
||||
|
||||
/**
|
||||
* @deprecated As of VaultAPI 1.4 use @{link {@link #has(OfflinePlayer, String, double)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean has(String playerName, String worldName, double amount);
|
||||
|
||||
/**
|
||||
* Withdraw an amount from an account associated with a UUID - DO NOT USE
|
||||
* NEGATIVE AMOUNTS
|
||||
*
|
||||
* @param uuid to withdraw from
|
||||
* @param amount Amount to withdraw
|
||||
* @return Detailed response of transaction
|
||||
*/
|
||||
public EconomyResponse withdraw(UUID uuid, double amount);
|
||||
|
||||
/**
|
||||
* Withdraw an amount from an account associated with a player - DO NOT USE
|
||||
* NEGATIVE AMOUNTS
|
||||
* @param player to withdraw from
|
||||
* @param amount Amount to withdraw
|
||||
*/
|
||||
public default EconomyResponse withdrawPlayer(OfflinePlayer player, double amount){
|
||||
return withdraw(player.getUniqueId(), 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.
|
||||
*
|
||||
* @param player to check
|
||||
* @param worldName to check with
|
||||
* @param amount to check for
|
||||
* @return True if <b>player</b> has <b>amount</b>, False else wise
|
||||
*/
|
||||
public boolean has(OfflinePlayer player, String worldName, double amount);
|
||||
|
||||
/**
|
||||
* @deprecated As of VaultAPI 1.4 use {@link #withdrawPlayer(OfflinePlayer, double)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public EconomyResponse withdrawPlayer(String playerName, double amount);
|
||||
|
||||
/**
|
||||
* Withdraw an amount from an account associated with a UUID 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.
|
||||
*
|
||||
* @param uuid to withdraw from
|
||||
* @param worldName - name of the world
|
||||
* @param amount Amount to withdraw
|
||||
* Withdraw an amount from a player - DO NOT USE NEGATIVE AMOUNTS
|
||||
*
|
||||
* @param player to withdraw from
|
||||
* @param amount Amount to withdraw
|
||||
* @return Detailed response of transaction
|
||||
*/
|
||||
public EconomyResponse withdraw(UUID uuid, String worldName, double amount);
|
||||
public EconomyResponse withdrawPlayer(OfflinePlayer player, double amount);
|
||||
|
||||
/**
|
||||
* Withdraw an amount from an account associated with 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.
|
||||
* @param player to withdraw from
|
||||
* @param worldName - name of the world
|
||||
* @param amount Amount to withdraw
|
||||
*/
|
||||
public default EconomyResponse withdrawPlayer(OfflinePlayer player, String worldName, double amount){
|
||||
return withdraw(player.getUniqueId(), worldName, amount);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated As of VaultAPI 1.4 use {@link #withdrawPlayer(OfflinePlayer, String, double)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public EconomyResponse withdrawPlayer(String playerName, String worldName, double amount);
|
||||
|
||||
/**
|
||||
* Deposit an amount to an account associated with the given UUID - DO NOT USE
|
||||
* NEGATIVE AMOUNTS
|
||||
*
|
||||
* @param uuid to deposit to
|
||||
* @param amount Amount to deposit
|
||||
* 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.
|
||||
* @param player to withdraw from
|
||||
* @param worldName - name of the world
|
||||
* @param amount Amount to withdraw
|
||||
* @return Detailed response of transaction
|
||||
*/
|
||||
public EconomyResponse deposit(UUID uuid, double amount);
|
||||
public EconomyResponse withdrawPlayer(OfflinePlayer player, String worldName, double amount);
|
||||
|
||||
/**
|
||||
* Deposit an amount to an account associated with the given player - DO NOT USE
|
||||
* NEGATIVE AMOUNTS
|
||||
* @param player to deposit to
|
||||
* @param amount Amount to deposit
|
||||
*/
|
||||
public default EconomyResponse depositPlayer(OfflinePlayer player, double amount){
|
||||
return deposit(player.getUniqueId(), amount);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated As of VaultAPI 1.4 use {@link #depositPlayer(OfflinePlayer, double)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public EconomyResponse depositPlayer(String playerName, double amount);
|
||||
|
||||
/**
|
||||
* Deposit an amount from an account associated with a UUID 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.
|
||||
*
|
||||
* @param uuid to deposit to
|
||||
* @param worldName name of the world
|
||||
* @param amount Amount to deposit
|
||||
* Deposit an amount to a player - DO NOT USE NEGATIVE AMOUNTS
|
||||
*
|
||||
* @param player to deposit to
|
||||
* @param amount Amount to deposit
|
||||
* @return Detailed response of transaction
|
||||
*/
|
||||
public EconomyResponse deposit(UUID uuid, String worldName, double amount);
|
||||
public EconomyResponse depositPlayer(OfflinePlayer player, double amount);
|
||||
|
||||
/**
|
||||
* Deposit an amount from an account associated with 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.
|
||||
* @param player to deposit to
|
||||
* @param worldName name of the world
|
||||
* @param amount Amount to deposit
|
||||
*/
|
||||
public default EconomyResponse depositPlayer(OfflinePlayer player, String worldName, double amount){
|
||||
return deposit(player.getUniqueId(), worldName, amount);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated As of VaultAPI 1.4 use {@link #depositPlayer(OfflinePlayer, String, double)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public EconomyResponse depositPlayer(String playerName, String worldName, double amount);
|
||||
|
||||
/*
|
||||
* Bank methods follow.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Creates a bank account with the specified name and the given UUID as the
|
||||
* owner
|
||||
*
|
||||
* @param name of account
|
||||
* @param uuid the account should be linked to
|
||||
* @return EconomyResponse Object
|
||||
*/
|
||||
public EconomyResponse createBank(String name, UUID uuid);
|
||||
|
||||
/**
|
||||
* Creates a bank account with the specified name and the given player as the
|
||||
* owner
|
||||
* 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.
|
||||
*
|
||||
* @param name of account
|
||||
* @param player the account should be linked to
|
||||
* @return EconomyResponse Object
|
||||
* @param player to deposit to
|
||||
* @param worldName name of the world
|
||||
* @param amount Amount to deposit
|
||||
* @return Detailed response of transaction
|
||||
*/
|
||||
public default EconomyResponse createBank(String name, OfflinePlayer player){
|
||||
return createBank(name, player.getUniqueId());
|
||||
}
|
||||
public EconomyResponse depositPlayer(OfflinePlayer player, String worldName, double amount);
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated As of VaultAPI 1.4 use {@link #createBank(String, OfflinePlayer)} instead.
|
||||
* @deprecated As of VaultAPI 1.4 use {{@link #createBank(String, OfflinePlayer)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public EconomyResponse createBank(String name, String player);
|
||||
|
||||
/**
|
||||
* Creates a bank account with the specified name and the player as the owner
|
||||
* @param name of account
|
||||
* @param player the account should be linked to
|
||||
* @return EconomyResponse Object
|
||||
*/
|
||||
public EconomyResponse createBank(String name, OfflinePlayer player);
|
||||
|
||||
/**
|
||||
* Deletes a bank account with the specified name.
|
||||
*
|
||||
* @param name of the back to delete
|
||||
* @return if the operation completed successfully
|
||||
*/
|
||||
|
@ -458,17 +259,15 @@ public interface Economy {
|
|||
|
||||
/**
|
||||
* Returns the amount the bank has
|
||||
*
|
||||
* @param name of the account
|
||||
* @return EconomyResponse Object
|
||||
*/
|
||||
public EconomyResponse bankBalance(String name);
|
||||
|
||||
/**
|
||||
* Returns true or false whether the bank has the amount specified - DO NOT USE
|
||||
* NEGATIVE AMOUNTS
|
||||
*
|
||||
* @param name of the account
|
||||
* Returns true or false whether the bank has the amount specified - DO NOT USE NEGATIVE AMOUNTS
|
||||
*
|
||||
* @param name of the account
|
||||
* @param amount to check for
|
||||
* @return EconomyResponse Object
|
||||
*/
|
||||
|
@ -476,8 +275,8 @@ public interface Economy {
|
|||
|
||||
/**
|
||||
* Withdraw an amount from a bank account - DO NOT USE NEGATIVE AMOUNTS
|
||||
*
|
||||
* @param name of the account
|
||||
*
|
||||
* @param name of the account
|
||||
* @param amount to withdraw
|
||||
* @return EconomyResponse Object
|
||||
*/
|
||||
|
@ -485,21 +284,18 @@ public interface Economy {
|
|||
|
||||
/**
|
||||
* Deposit an amount into a bank account - DO NOT USE NEGATIVE AMOUNTS
|
||||
*
|
||||
* @param name of the account
|
||||
*
|
||||
* @param name of the account
|
||||
* @param amount to deposit
|
||||
* @return EconomyResponse Object
|
||||
*/
|
||||
public EconomyResponse bankDeposit(String name, double amount);
|
||||
|
||||
/**
|
||||
* Check if a uuid is the owner of a bank account
|
||||
*
|
||||
* @param name of the account
|
||||
* @param uuid to check for ownership
|
||||
* @return EconomyResponse Object
|
||||
* @deprecated As of VaultAPI 1.4 use {{@link #isBankOwner(String, OfflinePlayer)} instead.
|
||||
*/
|
||||
public EconomyResponse isBankOwner(String name, UUID uuid);
|
||||
@Deprecated
|
||||
public EconomyResponse isBankOwner(String name, String playerName);
|
||||
|
||||
/**
|
||||
* Check if a player is the owner of a bank account
|
||||
|
@ -508,25 +304,13 @@ public interface Economy {
|
|||
* @param player to check for ownership
|
||||
* @return EconomyResponse Object
|
||||
*/
|
||||
public default EconomyResponse isBankOwner(String name, OfflinePlayer player){
|
||||
return isBankOwner(name, player.getUniqueId());
|
||||
}
|
||||
public EconomyResponse isBankOwner(String name, OfflinePlayer player);
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated As of VaultAPI 1.4 use {@link #isBankOwner(String, OfflinePlayer)} instead.
|
||||
* @deprecated As of VaultAPI 1.4 use {{@link #isBankMember(String, OfflinePlayer)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public EconomyResponse isBankOwner(String name, String playerName);
|
||||
|
||||
/**
|
||||
* Check if the uuid is a member of the bank account
|
||||
*
|
||||
* @param name of the account
|
||||
* @param uuid to check membership
|
||||
* @return EconomyResponse Object
|
||||
*/
|
||||
public EconomyResponse isBankMember(String name, UUID uuid);
|
||||
public EconomyResponse isBankMember(String name, String playerName);
|
||||
|
||||
/**
|
||||
* Check if the player is a member of the bank account
|
||||
|
@ -535,20 +319,10 @@ public interface Economy {
|
|||
* @param player to check membership
|
||||
* @return EconomyResponse Object
|
||||
*/
|
||||
public default EconomyResponse isBankMember(String name, OfflinePlayer player){
|
||||
return isBankMember(name, player.getUniqueId());
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated As of VaultAPI 1.4 use {@link #isBankMember(String, OfflinePlayer)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public EconomyResponse isBankMember(String name, String playerName);
|
||||
public EconomyResponse isBankMember(String name, OfflinePlayer player);
|
||||
|
||||
/**
|
||||
* Gets the list of banks
|
||||
*
|
||||
* @return the List of Banks
|
||||
*/
|
||||
public List<String> getBanks();
|
||||
|
@ -564,9 +338,7 @@ public interface Economy {
|
|||
* @param player OfflinePlayer
|
||||
* @return if the account creation was successful
|
||||
*/
|
||||
public default boolean createPlayerAccount(OfflinePlayer player){
|
||||
return createAccount(player.getUniqueId(),player.getName());
|
||||
}
|
||||
public boolean createPlayerAccount(OfflinePlayer player);
|
||||
|
||||
/**
|
||||
* @deprecated As of VaultAPI 1.4 use {{@link #createPlayerAccount(OfflinePlayer, String)} instead.
|
||||
|
@ -581,7 +353,5 @@ public interface Economy {
|
|||
* @param worldName String name of the world
|
||||
* @return if the account creation was successful
|
||||
*/
|
||||
public default boolean createPlayerAccount(OfflinePlayer player, String worldName){
|
||||
return createAccount(player.getUniqueId(),player.getName(),worldName);
|
||||
}
|
||||
}
|
||||
public boolean createPlayerAccount(OfflinePlayer player, String worldName);
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package net.milkbowl.vault.economy;
|
||||
|
||||
public class EconomyWrapper {
|
||||
private final Economy economy;
|
||||
public EconomyWrapper(Economy economy){
|
||||
this.economy = economy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Will convert the Economy to a new IdentityEconomy
|
||||
* which IdentityEconomy#isLegacy() returns true.
|
||||
* Methods regarding UUID will fail fast.
|
||||
* @return a legacy economy
|
||||
*/
|
||||
public LegacyEconomy legacy(){
|
||||
return new LegacyEconomy(economy);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,289 @@
|
|||
/* This file is part of Vault.
|
||||
|
||||
Vault is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Vault is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with Vault. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.milkbowl.vault.economy;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* The main economy API
|
||||
*/
|
||||
public interface IdentityEconomy extends Economy{
|
||||
/**
|
||||
* Used to determine if IdentityEconomy was built through
|
||||
* the EconomyWrapper as a LegacyEconomy.
|
||||
* If true, methods such as {@link #getAllRecords()} and {@link #getAllOnline()} (UUID)}
|
||||
* will not be work.
|
||||
* This was made in order to support plugins which use older versions of VaultAPI/Vault.
|
||||
* You can also use it / override it to disable previous mentioned methods!
|
||||
* @return if this is a legacy economy
|
||||
*/
|
||||
public default boolean isLegacy(){
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Account-related methods follow.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Attempts to create a account for the given uuid
|
||||
*
|
||||
* @param uuid associated with the account
|
||||
* @param name associated with the account.
|
||||
* @return if the account creation was successful
|
||||
*/
|
||||
public boolean createAccount(UUID uuid, String name);
|
||||
|
||||
/**
|
||||
* Attempts to create an account for the given UUID on the specified world
|
||||
* IMPLEMENTATION SPECIFIC - if an economy plugin does not support this then
|
||||
* false will always be returned.
|
||||
*
|
||||
* @param uuid associated with the account
|
||||
* @param name associated with the account.
|
||||
* @param worldName String name of the world
|
||||
* @return if the account creation was successful
|
||||
*/
|
||||
public boolean createAccount(UUID uuid, String name, String worldName);
|
||||
|
||||
/**
|
||||
* Returns a map that represents all of the stored UUIDs which have accounts in the
|
||||
* plugin (in the database, not memory), as well as their last-known-name. This is used for Vault's economy
|
||||
* converter and should be given every account available.
|
||||
* Needs IdentityEconomy#hasUUIDSupport() to be true.
|
||||
*
|
||||
* @return a {@link Map} composed of the accounts keyed by their UUID, along
|
||||
* with their associated last-known-name.
|
||||
*/
|
||||
public Map<UUID, String> getAllRecords();
|
||||
|
||||
/**
|
||||
* Returns a collection of all UUIDs which have accounts in the plugin and are currently
|
||||
* online/connected to the server.
|
||||
* This is used for Vault's economy converter and should
|
||||
* Needs IdentityEconomy#hasUUIDSupport() to be true.
|
||||
* @return a {@link Collection} of all UUIDs which have accounts in the plugin
|
||||
*/
|
||||
public Collection<UUID> getAllOnline();
|
||||
|
||||
/**
|
||||
* Gets the last known name of an account owned by the given UUID. Required for
|
||||
* messages to be more human-readable than UUIDs alone can provide.
|
||||
*
|
||||
* @param uuid UUID to look up.
|
||||
*/
|
||||
public String getAccountName(UUID uuid);
|
||||
|
||||
/**
|
||||
* Checks if this uuid has an account yet
|
||||
*
|
||||
* @param uuid to check
|
||||
* @return if the uuid has an account
|
||||
*/
|
||||
public boolean hasAccount(UUID uuid);
|
||||
|
||||
/**
|
||||
* Checks if this uuid has an account yet on the given world
|
||||
*
|
||||
* @param uuid to check
|
||||
* @param worldName world-specific account
|
||||
* @return if the uuid has an account
|
||||
*/
|
||||
public boolean hasAccount(UUID uuid, String worldName);
|
||||
|
||||
/**
|
||||
* A method which changes the name associated with the given UUID in the
|
||||
* Map<UUID, String> received from {@link #getAllRecords()}
|
||||
*
|
||||
* @param uuid which is having a name change.
|
||||
* @param name name that will be associated with the UUID in the
|
||||
* Map<UUID, String> map.
|
||||
* @return true if the name change is successful.
|
||||
*/
|
||||
public boolean renameAccount(UUID uuid, String name);
|
||||
|
||||
/**
|
||||
* Gets balance of a UUID
|
||||
*
|
||||
* @param uuid of the account to get a balance for
|
||||
* @return Amount currently held in account associated with the given UUID
|
||||
*/
|
||||
public double getBalance(UUID uuid);
|
||||
|
||||
/**
|
||||
* Gets balance of a UUID on the specified world. IMPLEMENTATION SPECIFIC - if
|
||||
* an economy plugin does not support this the global balance will be returned.
|
||||
*
|
||||
* @param uuid of the account to get a balance for
|
||||
* @param world name of the world
|
||||
* @return Amount currently held in account associated with the given UUID
|
||||
*/
|
||||
public double getBalance(UUID uuid, String world);
|
||||
|
||||
/**
|
||||
* Checks if the account associated with the given UUID has the amount - DO NOT
|
||||
* USE NEGATIVE AMOUNTS
|
||||
*
|
||||
* @param uuid to check
|
||||
* @param amount to check for
|
||||
* @return True if <b>UUID</b> has <b>amount</b>, False else wise
|
||||
*/
|
||||
public boolean has(UUID uuid, double amount);
|
||||
|
||||
/**
|
||||
* Checks if the account associated with the given UUID has the amount in the
|
||||
* given world - DO NOT USE NEGATIVE AMOUNTS IMPLEMENTATION SPECIFIC - if an
|
||||
* economy plugin does not support this the global balance will be returned.
|
||||
*
|
||||
* @param uuid to check
|
||||
* @param worldName to check with
|
||||
* @param amount to check for
|
||||
* @return True if <b>UUID</b> has <b>amount</b> in the given <b>world</b>,
|
||||
* False else wise
|
||||
*/
|
||||
public boolean has(UUID uuid, String worldName, double amount);
|
||||
|
||||
/**
|
||||
* Withdraw an amount from an account associated with a UUID - DO NOT USE
|
||||
* NEGATIVE AMOUNTS
|
||||
*
|
||||
* @param uuid to withdraw from
|
||||
* @param amount Amount to withdraw
|
||||
* @return Detailed response of transaction
|
||||
*/
|
||||
public EconomyResponse withdraw(UUID uuid, double amount);
|
||||
|
||||
/**
|
||||
* Withdraw an amount from an account associated with a UUID 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.
|
||||
*
|
||||
* @param uuid to withdraw from
|
||||
* @param worldName - name of the world
|
||||
* @param amount Amount to withdraw
|
||||
* @return Detailed response of transaction
|
||||
*/
|
||||
public EconomyResponse withdraw(UUID uuid, String worldName, double amount);
|
||||
|
||||
/**
|
||||
* Deposit an amount to an account associated with the given UUID - DO NOT USE
|
||||
* NEGATIVE AMOUNTS
|
||||
*
|
||||
* @param uuid to deposit to
|
||||
* @param amount Amount to deposit
|
||||
* @return Detailed response of transaction
|
||||
*/
|
||||
public EconomyResponse deposit(UUID uuid, double amount);
|
||||
|
||||
/**
|
||||
* Deposit an amount from an account associated with a UUID 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.
|
||||
*
|
||||
* @param uuid to deposit to
|
||||
* @param worldName name of the world
|
||||
* @param amount Amount to deposit
|
||||
* @return Detailed response of transaction
|
||||
*/
|
||||
public EconomyResponse deposit(UUID uuid, String worldName, double amount);
|
||||
|
||||
/*
|
||||
* Bank methods follow.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Creates a bank account with the specified name and the given UUID as the
|
||||
* owner
|
||||
*
|
||||
* @param name of account
|
||||
* @param uuid the account should be linked to
|
||||
* @return EconomyResponse Object
|
||||
*/
|
||||
public EconomyResponse createBank(String name, UUID uuid);
|
||||
|
||||
/**
|
||||
* Deletes a bank account with the specified name.
|
||||
*
|
||||
* @param name of the back to delete
|
||||
* @return if the operation completed successfully
|
||||
*/
|
||||
public EconomyResponse deleteBank(String name);
|
||||
|
||||
/**
|
||||
* Returns the amount the bank has
|
||||
*
|
||||
* @param name of the account
|
||||
* @return EconomyResponse Object
|
||||
*/
|
||||
public EconomyResponse bankBalance(String name);
|
||||
|
||||
/**
|
||||
* Returns true or false whether the bank has the amount specified - DO NOT USE
|
||||
* NEGATIVE AMOUNTS
|
||||
*
|
||||
* @param name of the account
|
||||
* @param amount to check for
|
||||
* @return EconomyResponse Object
|
||||
*/
|
||||
public EconomyResponse bankHas(String name, double amount);
|
||||
|
||||
/**
|
||||
* Withdraw an amount from a bank account - DO NOT USE NEGATIVE AMOUNTS
|
||||
*
|
||||
* @param name of the account
|
||||
* @param amount to withdraw
|
||||
* @return EconomyResponse Object
|
||||
*/
|
||||
public EconomyResponse bankWithdraw(String name, double amount);
|
||||
|
||||
/**
|
||||
* Deposit an amount into a bank account - DO NOT USE NEGATIVE AMOUNTS
|
||||
*
|
||||
* @param name of the account
|
||||
* @param amount to deposit
|
||||
* @return EconomyResponse Object
|
||||
*/
|
||||
public EconomyResponse bankDeposit(String name, double amount);
|
||||
|
||||
/**
|
||||
* Check if a uuid is the owner of a bank account
|
||||
*
|
||||
* @param name of the account
|
||||
* @param uuid to check for ownership
|
||||
* @return EconomyResponse Object
|
||||
*/
|
||||
public EconomyResponse isBankOwner(String name, UUID uuid);
|
||||
|
||||
/**
|
||||
* Check if the uuid is a member of the bank account
|
||||
*
|
||||
* @param name of the account
|
||||
* @param uuid to check membership
|
||||
* @return EconomyResponse Object
|
||||
*/
|
||||
public EconomyResponse isBankMember(String name, UUID uuid);
|
||||
|
||||
/**
|
||||
* Gets the list of banks
|
||||
*
|
||||
* @return the List of Banks
|
||||
*/
|
||||
public List<String> getBanks();
|
||||
}
|
|
@ -0,0 +1,331 @@
|
|||
package net.milkbowl.vault.economy;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
public class LegacyEconomy implements IdentityEconomy{
|
||||
private final Economy economy;
|
||||
protected LegacyEconomy(Economy economy){
|
||||
this.economy = economy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLegacy() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return economy.isEnabled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return economy.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasBankSupport() {
|
||||
return economy.hasBankSupport();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fractionalDigits() {
|
||||
return economy.fractionalDigits();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String format(double amount) {
|
||||
return economy.format(amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String currencyNamePlural() {
|
||||
return economy.currencyNamePlural();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String currencyNameSingular() {
|
||||
return economy.currencyNameSingular();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasAccount(String playerName) {
|
||||
return economy.hasAccount(playerName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasAccount(OfflinePlayer player) {
|
||||
return economy.hasAccount(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasAccount(String playerName, String worldName) {
|
||||
return economy.hasAccount(playerName, worldName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasAccount(OfflinePlayer player, String worldName) {
|
||||
return economy.hasAccount(player, worldName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBalance(String playerName) {
|
||||
return economy.getBalance(playerName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBalance(OfflinePlayer player) {
|
||||
return economy.getBalance(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBalance(String playerName, String world) {
|
||||
return economy.getBalance(playerName, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBalance(OfflinePlayer player, String world) {
|
||||
return economy.getBalance(player, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean has(String playerName, double amount) {
|
||||
return economy.has(playerName, amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean has(OfflinePlayer player, double amount) {
|
||||
return economy.has(player, amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean has(String playerName, String worldName, double amount) {
|
||||
return economy.has(playerName, worldName, amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean has(OfflinePlayer player, String worldName, double amount) {
|
||||
return economy.has(player, worldName, amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse withdrawPlayer(String playerName, double amount) {
|
||||
return economy.withdrawPlayer(playerName, amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse withdrawPlayer(OfflinePlayer player, double amount) {
|
||||
return economy.withdrawPlayer(player, amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse withdrawPlayer(String playerName, String worldName, double amount) {
|
||||
return economy.withdrawPlayer(playerName, worldName, amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse withdrawPlayer(OfflinePlayer player, String worldName, double amount) {
|
||||
return economy.withdrawPlayer(player, worldName, amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse depositPlayer(String playerName, double amount) {
|
||||
return economy.depositPlayer(playerName, amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse depositPlayer(OfflinePlayer player, double amount) {
|
||||
return economy.depositPlayer(player, amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse depositPlayer(String playerName, String worldName, double amount) {
|
||||
return economy.depositPlayer(playerName, worldName, amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse depositPlayer(OfflinePlayer player, String worldName, double amount) {
|
||||
return economy.depositPlayer(player, worldName, amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse createBank(String name, String player) {
|
||||
return economy.createBank(name, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse createBank(String name, OfflinePlayer player) {
|
||||
return economy.createBank(name, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse isBankOwner(String name, String playerName) {
|
||||
return economy.isBankOwner(name, playerName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse isBankOwner(String name, OfflinePlayer player) {
|
||||
return economy.isBankOwner(name, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse isBankMember(String name, String playerName) {
|
||||
return economy.isBankMember(name, playerName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse isBankMember(String name, OfflinePlayer player) {
|
||||
return economy.isBankMember(name, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean createPlayerAccount(String playerName) {
|
||||
return economy.createPlayerAccount(playerName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean createPlayerAccount(OfflinePlayer player) {
|
||||
return economy.createPlayerAccount(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean createPlayerAccount(String playerName, String worldName) {
|
||||
return economy.createPlayerAccount(playerName, worldName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean createPlayerAccount(OfflinePlayer player, String worldName) {
|
||||
return economy.createPlayerAccount(player, worldName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean createAccount(UUID uuid, String name) {
|
||||
throw new UnsupportedOperationException("LegacyEconomy! Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean createAccount(UUID uuid, String name, String worldName) {
|
||||
throw new UnsupportedOperationException("LegacyEconomy! Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<UUID, String> getAllRecords() {
|
||||
throw new UnsupportedOperationException("LegacyEconomy! Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<UUID> getAllOnline() {
|
||||
throw new UnsupportedOperationException("LegacyEconomy! Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAccountName(UUID uuid) {
|
||||
throw new UnsupportedOperationException("LegacyEconomy! Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasAccount(UUID uuid) {
|
||||
throw new UnsupportedOperationException("LegacyEconomy! Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasAccount(UUID uuid, String worldName) {
|
||||
throw new UnsupportedOperationException("LegacyEconomy! Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renameAccount(UUID uuid, String name) {
|
||||
throw new UnsupportedOperationException("LegacyEconomy! Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBalance(UUID uuid) {
|
||||
throw new UnsupportedOperationException("LegacyEconomy! Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getBalance(UUID uuid, String world) {
|
||||
throw new UnsupportedOperationException("LegacyEconomy! Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean has(UUID uuid, double amount) {
|
||||
throw new UnsupportedOperationException("LegacyEconomy! Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean has(UUID uuid, String worldName, double amount) {
|
||||
throw new UnsupportedOperationException("LegacyEconomy! Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse withdraw(UUID uuid, double amount) {
|
||||
throw new UnsupportedOperationException("LegacyEconomy! Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse withdraw(UUID uuid, String worldName, double amount) {
|
||||
throw new UnsupportedOperationException("LegacyEconomy! Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse deposit(UUID uuid, double amount) {
|
||||
throw new UnsupportedOperationException("LegacyEconomy! Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse deposit(UUID uuid, String worldName, double amount) {
|
||||
throw new UnsupportedOperationException("LegacyEconomy! Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse createBank(String name, UUID uuid) {
|
||||
throw new UnsupportedOperationException("LegacyEconomy! Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse deleteBank(String name) {
|
||||
return economy.deleteBank(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse bankBalance(String name) {
|
||||
return economy.bankBalance(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse bankHas(String name, double amount) {
|
||||
return economy.bankHas(name, amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse bankWithdraw(String name, double amount) {
|
||||
return economy.bankWithdraw(name, amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse bankDeposit(String name, double amount) {
|
||||
return economy.bankDeposit(name, amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse isBankOwner(String name, UUID uuid) {
|
||||
throw new UnsupportedOperationException("LegacyEconomy! Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EconomyResponse isBankMember(String name, UUID uuid) {
|
||||
throw new UnsupportedOperationException("LegacyEconomy! Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getBanks() {
|
||||
return economy.getBanks();
|
||||
}
|
||||
}
|
|
@ -7,6 +7,7 @@ import java.util.Collection;
|
|||
/**
|
||||
* This interface is used to provide multi-world, multi-currency support for the economy.
|
||||
* It allows disabling currencies/economies.
|
||||
* It forces currencies to support UUIDs.
|
||||
*/
|
||||
public interface MultiEconomy {
|
||||
|
||||
|
@ -47,7 +48,7 @@ public interface MultiEconomy {
|
|||
* @param name The name of the implementation to get.
|
||||
* @return The implementation with the specified name.
|
||||
*/
|
||||
public Economy getImplementation(String name);
|
||||
public IdentityEconomy getImplementation(String name);
|
||||
|
||||
/**
|
||||
* Used to get the default implementation. This could be the default implementation for the server globally or
|
||||
|
@ -56,7 +57,7 @@ public interface MultiEconomy {
|
|||
* @return The implementation that is the default for the server if multi-world support is not available
|
||||
* otherwise the default for the default world.
|
||||
*/
|
||||
public Economy getDefault();
|
||||
public IdentityEconomy getDefault();
|
||||
|
||||
/**
|
||||
* Checks to see if the default implementation is not null.
|
||||
|
@ -75,7 +76,7 @@ public interface MultiEconomy {
|
|||
* @return The default implementation for the specified world if this implementation has multi-world
|
||||
* support, otherwise the default implementation for the server.
|
||||
*/
|
||||
public Economy getDefault(String world);
|
||||
public IdentityEconomy getDefault(String world);
|
||||
|
||||
/**
|
||||
* Checks to see if the default implementation for the specified world is not null.
|
||||
|
@ -92,15 +93,15 @@ public interface MultiEconomy {
|
|||
*
|
||||
* @return A collection of every implementation identifier that is available for the server.
|
||||
*/
|
||||
public Collection<Economy> getAllImplementations();
|
||||
public Collection<IdentityEconomy> getAllImplementations();
|
||||
|
||||
/**
|
||||
* Used to get a collection of every {@link Economy} object that is available in the specified world if
|
||||
* this implementation has multi-world support, otherwise all {@link Economy} objects for the server.
|
||||
* Used to get a collection of every {@link IdentityEconomy} object that is available in the specified world if
|
||||
* this implementation has multi-world support, otherwise all {@link IdentityEconomy} objects for the server.
|
||||
*
|
||||
* @param world The world we want to get the {@link Economy} objects for.
|
||||
* @param world The world we want to get the {@link IdentityEconomy} objects for.
|
||||
* @return A collection of every implementation identifier that is available in the specified world if
|
||||
* this implementation has multi-world support, otherwise all implementation identifiers for the server.
|
||||
*/
|
||||
public Collection<Economy> getAllImplementations(String world);
|
||||
public Collection<IdentityEconomy> getAllImplementations(String world);
|
||||
}
|
Loading…
Reference in New Issue