diff --git a/pom.xml b/pom.xml index 959b534..5c8c467 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 net.milkbowl.vault VaultAPI - 1.7 + 1.8 VaultAPI Vault is a Permissions & Economy API to allow plugins to more easily hook into these systems without needing to hook each individual system themselves. diff --git a/src/main/java/net/milkbowl/vault/economy/AbstractEconomy.java b/src/main/java/net/milkbowl/vault/economy/AbstractEconomy.java deleted file mode 100644 index 4fe0e37..0000000 --- a/src/main/java/net/milkbowl/vault/economy/AbstractEconomy.java +++ /dev/null @@ -1,87 +0,0 @@ -package net.milkbowl.vault.economy; - -import org.bukkit.OfflinePlayer; - -@SuppressWarnings("deprecation") -public abstract class AbstractEconomy implements Economy { - - @Override - public boolean hasAccount(OfflinePlayer player) { - if (player.getName() == null) return false; - return hasAccount(player.getName()); - } - - @Override - public boolean hasAccount(OfflinePlayer player, String worldName) { - if (player.getName() == null) return false; - return hasAccount(player.getName(), worldName); - } - - @Override - public double getBalance(OfflinePlayer player) { - return getBalance(player.getName()); - } - - @Override - public double getBalance(OfflinePlayer player, String world) { - return getBalance(player.getName(), world); - } - - @Override - public boolean has(OfflinePlayer player, double amount) { - if (player.getName() == null) return false; - return has(player.getName(), amount); - } - - @Override - public boolean has(OfflinePlayer player, String worldName, double amount) { - if (player.getName() == null) return false; - return has(player.getName(), worldName, amount); - } - - @Override - public EconomyResponse withdrawPlayer(OfflinePlayer player, double amount) { - return withdrawPlayer(player.getName(), amount); - } - - @Override - public EconomyResponse withdrawPlayer(OfflinePlayer player, String worldName, double amount) { - return withdrawPlayer(player.getName(), worldName, amount); - } - - @Override - public EconomyResponse depositPlayer(OfflinePlayer player, double amount) { - return depositPlayer(player.getName(), amount); - } - - @Override - public EconomyResponse depositPlayer(OfflinePlayer player, String worldName, double amount) { - return depositPlayer(player.getName(), worldName, amount); - } - - @Override - public EconomyResponse createBank(String name, OfflinePlayer player) { - return createBank(name, player.getName()); - } - - @Override - public EconomyResponse isBankOwner(String name, OfflinePlayer player) { - return isBankOwner(name, player.getName()); - } - - @Override - public EconomyResponse isBankMember(String name, OfflinePlayer player) { - return isBankMember(name, player.getName()); - } - - @Override - public boolean createPlayerAccount(OfflinePlayer player) { - return createPlayerAccount(player.getName()); - } - - @Override - public boolean createPlayerAccount(OfflinePlayer player, String worldName) { - return createPlayerAccount(player.getName(), worldName); - } - -} diff --git a/src/main/java/net/milkbowl/vault/economy/Economy.java b/src/main/java/net/milkbowl/vault/economy/Economy.java index 1d14587..a1b3ed9 100644 --- a/src/main/java/net/milkbowl/vault/economy/Economy.java +++ b/src/main/java/net/milkbowl/vault/economy/Economy.java @@ -17,6 +17,7 @@ package net.milkbowl.vault.economy; import java.util.List; +import java.util.UUID; import org.bukkit.OfflinePlayer; @@ -80,7 +81,7 @@ public interface Economy { /** * - * @deprecated As of VaultAPI 1.4 use {@link #hasAccount(OfflinePlayer)} instead. + * @deprecated As of VaultAPI 1.4 use {@link #hasAccount(OfflinePlayer)} or {@link #hasAccount(UUID)} instead. */ @Deprecated public boolean hasAccount(String playerName); @@ -96,7 +97,15 @@ public interface Economy { public boolean hasAccount(OfflinePlayer player); /** - * @deprecated As of VaultAPI 1.4 use {@link #hasAccount(OfflinePlayer, String)} instead. + * Checks if this uuid has an account yet + * + * @param uuid to check + * @return if the uuid has an account + */ + public boolean hasAccount(UUID uuid); + + /** + * @deprecated As of VaultAPI 1.4 use {@link #hasAccount(OfflinePlayer, String)} or {@link #hasAccount(UUID, String)} instead. */ @Deprecated public boolean hasAccount(String playerName, String worldName); @@ -113,7 +122,16 @@ public interface Economy { public boolean hasAccount(OfflinePlayer player, String worldName); /** - * @deprecated As of VaultAPI 1.4 use {@link #getBalance(OfflinePlayer)} instead. + * 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); + + /** + * @deprecated As of VaultAPI 1.4 use {@link #getBalance(OfflinePlayer)} or {@link #getBalance(UUID)} instead. */ @Deprecated public double getBalance(String playerName); @@ -127,7 +145,15 @@ public interface Economy { public double getBalance(OfflinePlayer player); /** - * @deprecated As of VaultAPI 1.4 use {@link #getBalance(OfflinePlayer, String)} instead. + * 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); + + /** + * @deprecated As of VaultAPI 1.4 use {@link #getBalance(OfflinePlayer, String)} or {@link #getBalance(UUID, String)} instead. */ @Deprecated public double getBalance(String playerName, String world); @@ -142,7 +168,16 @@ public interface Economy { public double getBalance(OfflinePlayer player, String world); /** - * @deprecated As of VaultAPI 1.4 use {@link #has(OfflinePlayer, double)} instead. + * 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); + + /** + * @deprecated As of VaultAPI 1.4 use {@link #has(OfflinePlayer, double)} or {@link #has(UUID, double)} instead. */ @Deprecated public boolean has(String playerName, double amount); @@ -157,7 +192,16 @@ public interface Economy { public boolean has(OfflinePlayer player, double amount); /** - * @deprecated As of VaultAPI 1.4 use @{link {@link #has(OfflinePlayer, String, double)} instead. + * 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 UUID has amount, False else wise + */ + public boolean has(UUID uuid, double amount); + + /** + * @deprecated As of VaultAPI 1.4 use {@link #has(OfflinePlayer, String, double)} or {@link #has(UUID, String, double)} instead. */ @Deprecated public boolean has(String playerName, String worldName, double amount); @@ -169,12 +213,23 @@ public interface Economy { * @param player to check * @param worldName to check with * @param amount to check for - * @return True if player has amount, False else wise + * @return True if player has amount in the given world, False else wise */ public boolean has(OfflinePlayer player, String worldName, double amount); /** - * @deprecated As of VaultAPI 1.4 use {@link #withdrawPlayer(OfflinePlayer, double)} instead. + * 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 UUID has amount in the given world, False else wise + */ + public boolean has(UUID uuid, String worldName, double amount); + + /** + * @deprecated As of VaultAPI 1.4 use {@link #withdrawPlayer(OfflinePlayer, double)} or {@link #withdrawPlayer(UUID, double)} instead. */ @Deprecated public EconomyResponse withdrawPlayer(String playerName, double amount); @@ -189,7 +244,16 @@ public interface Economy { public EconomyResponse withdrawPlayer(OfflinePlayer player, double amount); /** - * @deprecated As of VaultAPI 1.4 use {@link #withdrawPlayer(OfflinePlayer, String, double)} instead. + * 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); + + /** + * @deprecated As of VaultAPI 1.4 use {@link #withdrawPlayer(OfflinePlayer, String, double)} or {@link #withdrawPlayer(UUID, String, double)} instead. */ @Deprecated public EconomyResponse withdrawPlayer(String playerName, String worldName, double amount); @@ -205,7 +269,17 @@ public interface Economy { public EconomyResponse withdrawPlayer(OfflinePlayer player, String worldName, double amount); /** - * @deprecated As of VaultAPI 1.4 use {@link #depositPlayer(OfflinePlayer, double)} instead. + * 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); + + /** + * @deprecated As of VaultAPI 1.4 use {@link #depositPlayer(OfflinePlayer, double)} or {@link #depositPlayer(UUID, double)} instead. */ @Deprecated public EconomyResponse depositPlayer(String playerName, double amount); @@ -220,13 +294,22 @@ public interface Economy { public EconomyResponse depositPlayer(OfflinePlayer player, double amount); /** - * @deprecated As of VaultAPI 1.4 use {@link #depositPlayer(OfflinePlayer, String, double)} instead. + * 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); + + /** + * @deprecated As of VaultAPI 1.4 use {@link #depositPlayer(OfflinePlayer, String, double)} or {@link #depositPlayer(UUID, String, double)} instead. */ @Deprecated public EconomyResponse depositPlayer(String playerName, String worldName, double amount); /** - * Deposit an amount to a player - DO NOT USE NEGATIVE AMOUNTS + * Deposit an amount to 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 @@ -237,7 +320,18 @@ public interface Economy { public EconomyResponse depositPlayer(OfflinePlayer player, String worldName, double amount); /** - * @deprecated As of VaultAPI 1.4 use {{@link #createBank(String, OfflinePlayer)} instead. + * 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); + + /** + * @deprecated As of VaultAPI 1.4 use {@link #createBank(String, OfflinePlayer)} or {@link #createBank(String, UUID)} instead. */ @Deprecated public EconomyResponse createBank(String name, String player); @@ -249,6 +343,14 @@ public interface Economy { * @return EconomyResponse Object */ public EconomyResponse createBank(String name, OfflinePlayer player); + + /** + * 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. @@ -292,7 +394,7 @@ public interface Economy { public EconomyResponse bankDeposit(String name, double amount); /** - * @deprecated As of VaultAPI 1.4 use {{@link #isBankOwner(String, OfflinePlayer)} instead. + * @deprecated As of VaultAPI 1.4 use {@link #isBankOwner(String, OfflinePlayer)} or {@link #isBankOwner(String, UUID)} instead. */ @Deprecated public EconomyResponse isBankOwner(String name, String playerName); @@ -305,9 +407,18 @@ public interface Economy { * @return EconomyResponse Object */ public EconomyResponse isBankOwner(String name, OfflinePlayer player); + + /** + * 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); /** - * @deprecated As of VaultAPI 1.4 use {{@link #isBankMember(String, OfflinePlayer)} instead. + * @deprecated As of VaultAPI 1.4 use {@link #isBankMember(String, OfflinePlayer)} or {@link #isBankMember(String, UUID)} instead. */ @Deprecated public EconomyResponse isBankMember(String name, String playerName); @@ -320,6 +431,15 @@ public interface Economy { * @return EconomyResponse Object */ public EconomyResponse isBankMember(String name, OfflinePlayer player); + + /** + * 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 @@ -328,7 +448,7 @@ public interface Economy { public List getBanks(); /** - * @deprecated As of VaultAPI 1.4 use {{@link #createPlayerAccount(OfflinePlayer)} instead. + * @deprecated As of VaultAPI 1.4 use {@link #createPlayerAccount(OfflinePlayer)} or {@link #createPlayerAccount(UUID)} instead. */ @Deprecated public boolean createPlayerAccount(String playerName); @@ -341,7 +461,14 @@ public interface Economy { public boolean createPlayerAccount(OfflinePlayer player); /** - * @deprecated As of VaultAPI 1.4 use {{@link #createPlayerAccount(OfflinePlayer, String)} instead. + * Attempts to create a account for the given uuid + * @param uuid associated with the account + * @return if the account creation was successful + */ + public boolean createAccount(UUID uuid); + + /** + * @deprecated As of VaultAPI 1.4 use {@link #createPlayerAccount(OfflinePlayer, String)} or {@link #createPlayerAccount(UUID, String)} instead. */ @Deprecated public boolean createPlayerAccount(String playerName, String worldName); @@ -354,4 +481,13 @@ public interface Economy { * @return if the account creation was successful */ public boolean createPlayerAccount(OfflinePlayer player, String worldName); + + /** + * 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 worldName String name of the world + * @return if the account creation was successful + */ + public boolean createAccount(UUID uuid, String worldName); }