From 5c61077842c0a0f781f554dedd09959ad693bf0e Mon Sep 17 00:00:00 2001 From: Llm Dl Date: Sun, 4 Apr 2021 10:32:25 -0500 Subject: [PATCH 01/95] Add UUID support to Vault. This commit adds UUID support to Vault, allowing plugins to bypass the OfflinePlayer methods which result in Bukkit trying to resolve a player to associate with the OfflinePlayer (via the server playercache and if that player doesn't exist via Mojang.) This is incredibly useful for any plugin which wants to have an Economy account that isn't associated with a player. This includes Towny, Factions, Shops plugins and others. Most importantly: having UUID methods will give these plugins an avenue to update from using the String accountName methods deprecated since Vault 1.4, which doesn't result in slow OfflinePlayer creation. AbstractEconomy has been updated so that the various Economy plugins supported internally by Vault will have support for the new methods in the same manner as when the OfflinePlayer methods were added. Small javadoc typos have also been fixed up (extra {'s, an additional {@link, etc.) --- pom.xml | 2 +- .../vault/economy/AbstractEconomy.java | 85 ++++++++- .../net/milkbowl/vault/economy/Economy.java | 170 ++++++++++++++++-- 3 files changed, 237 insertions(+), 20 deletions(-) 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 index 4fe0e37..c5ec32e 100644 --- a/src/main/java/net/milkbowl/vault/economy/AbstractEconomy.java +++ b/src/main/java/net/milkbowl/vault/economy/AbstractEconomy.java @@ -1,5 +1,8 @@ package net.milkbowl.vault.economy; +import java.util.UUID; + +import org.bukkit.Bukkit; import org.bukkit.OfflinePlayer; @SuppressWarnings("deprecation") @@ -16,6 +19,18 @@ public boolean hasAccount(OfflinePlayer player, String worldName) { if (player.getName() == null) return false; return hasAccount(player.getName(), worldName); } + + @Override + public boolean hasAccount(UUID uuid) { + if (uuid == null) return false; + return hasAccount(Bukkit.getOfflinePlayer(uuid)); + } + + @Override + public boolean hasAccount(UUID uuid, String worldName) { + if (uuid == null) return false; + return hasAccount(Bukkit.getOfflinePlayer(uuid), worldName); + } @Override public double getBalance(OfflinePlayer player) { @@ -23,8 +38,18 @@ public double getBalance(OfflinePlayer player) { } @Override - public double getBalance(OfflinePlayer player, String world) { - return getBalance(player.getName(), world); + public double getBalance(OfflinePlayer player, String worldName) { + return getBalance(player.getName(), worldName); + } + + @Override + public double getBalance(UUID uuid) { + return getBalance(Bukkit.getOfflinePlayer(uuid)); + } + + @Override + public double getBalance(UUID uuid, String worldName) { + return getBalance(Bukkit.getOfflinePlayer(uuid), worldName); } @Override @@ -38,6 +63,18 @@ public boolean has(OfflinePlayer player, String worldName, double amount) { if (player.getName() == null) return false; return has(player.getName(), worldName, amount); } + + @Override + public boolean has(UUID uuid, double amount) { + if (uuid == null) return false; + return has(Bukkit.getOfflinePlayer(uuid), amount); + } + + @Override + public boolean has(UUID uuid, String worldName, double amount) { + if (uuid == null) return false; + return has(Bukkit.getOfflinePlayer(uuid), worldName, amount); + } @Override public EconomyResponse withdrawPlayer(OfflinePlayer player, double amount) { @@ -49,6 +86,16 @@ public EconomyResponse withdrawPlayer(OfflinePlayer player, String worldName, do return withdrawPlayer(player.getName(), worldName, amount); } + @Override + public EconomyResponse withdrawPlayer(UUID uuid, double amount) { + return withdrawPlayer(Bukkit.getOfflinePlayer(uuid), amount); + } + + @Override + public EconomyResponse withdrawPlayer(UUID uuid, String worldName, double amount) { + return withdrawPlayer(Bukkit.getOfflinePlayer(uuid), worldName, amount); + } + @Override public EconomyResponse depositPlayer(OfflinePlayer player, double amount) { return depositPlayer(player.getName(), amount); @@ -59,20 +106,45 @@ public EconomyResponse depositPlayer(OfflinePlayer player, String worldName, dou return depositPlayer(player.getName(), worldName, amount); } + @Override + public EconomyResponse depositPlayer(UUID uuid, double amount) { + return depositPlayer(Bukkit.getOfflinePlayer(uuid), amount); + } + + @Override + public EconomyResponse depositPlayer(UUID uuid, String worldName, double amount) { + return depositPlayer(Bukkit.getOfflinePlayer(uuid), worldName, amount); + } + @Override public EconomyResponse createBank(String name, OfflinePlayer player) { return createBank(name, player.getName()); } + + @Override + public EconomyResponse createBank(String name, UUID uuid) { + return createBank(name, Bukkit.getOfflinePlayer(uuid)); + } @Override public EconomyResponse isBankOwner(String name, OfflinePlayer player) { return isBankOwner(name, player.getName()); } + + @Override + public EconomyResponse isBankOwner(String name, UUID uuid) { + return isBankOwner(name, Bukkit.getOfflinePlayer(uuid)); + } @Override public EconomyResponse isBankMember(String name, OfflinePlayer player) { return isBankMember(name, player.getName()); } + + @Override + public EconomyResponse isBankMember(String name, UUID uuid ) { + return isBankMember(name, Bukkit.getOfflinePlayer(uuid)); + } @Override public boolean createPlayerAccount(OfflinePlayer player) { @@ -84,4 +156,13 @@ public boolean createPlayerAccount(OfflinePlayer player, String worldName) { return createPlayerAccount(player.getName(), worldName); } + @Override + public boolean createPlayerAccount(UUID uuid) { + return createPlayerAccount(Bukkit.getOfflinePlayer(uuid)); + } + + @Override + public boolean createPlayerAccount(UUID uuid, String worldName) { + return createPlayerAccount(Bukkit.getOfflinePlayer(uuid), 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..5182654 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 withdrawPlayer(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 withdrawPlayer(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 depositPlayer(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 depositPlayer(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 createPlayerAccount(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 createPlayerAccount(UUID uuid, String worldName); } From 747940c8c63cc459c0a754aa7daa0294e4847cb6 Mon Sep 17 00:00:00 2001 From: Llm Dl Date: Tue, 28 Sep 2021 09:20:52 -0500 Subject: [PATCH 02/95] Improve UUID methods' names, dropping the word Player. These methods are meant for players, non-players and anything with a UUID. --- .../net/milkbowl/vault/economy/AbstractEconomy.java | 12 ++++++------ .../java/net/milkbowl/vault/economy/Economy.java | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/main/java/net/milkbowl/vault/economy/AbstractEconomy.java b/src/main/java/net/milkbowl/vault/economy/AbstractEconomy.java index c5ec32e..af60bc2 100644 --- a/src/main/java/net/milkbowl/vault/economy/AbstractEconomy.java +++ b/src/main/java/net/milkbowl/vault/economy/AbstractEconomy.java @@ -87,12 +87,12 @@ public EconomyResponse withdrawPlayer(OfflinePlayer player, String worldName, do } @Override - public EconomyResponse withdrawPlayer(UUID uuid, double amount) { + public EconomyResponse withdraw(UUID uuid, double amount) { return withdrawPlayer(Bukkit.getOfflinePlayer(uuid), amount); } @Override - public EconomyResponse withdrawPlayer(UUID uuid, String worldName, double amount) { + public EconomyResponse withdraw(UUID uuid, String worldName, double amount) { return withdrawPlayer(Bukkit.getOfflinePlayer(uuid), worldName, amount); } @@ -107,12 +107,12 @@ public EconomyResponse depositPlayer(OfflinePlayer player, String worldName, dou } @Override - public EconomyResponse depositPlayer(UUID uuid, double amount) { + public EconomyResponse deposit(UUID uuid, double amount) { return depositPlayer(Bukkit.getOfflinePlayer(uuid), amount); } @Override - public EconomyResponse depositPlayer(UUID uuid, String worldName, double amount) { + public EconomyResponse deposit(UUID uuid, String worldName, double amount) { return depositPlayer(Bukkit.getOfflinePlayer(uuid), worldName, amount); } @@ -157,12 +157,12 @@ public boolean createPlayerAccount(OfflinePlayer player, String worldName) { } @Override - public boolean createPlayerAccount(UUID uuid) { + public boolean createAccount(UUID uuid) { return createPlayerAccount(Bukkit.getOfflinePlayer(uuid)); } @Override - public boolean createPlayerAccount(UUID uuid, String worldName) { + public boolean createAccount(UUID uuid, String worldName) { return createPlayerAccount(Bukkit.getOfflinePlayer(uuid), worldName); } } diff --git a/src/main/java/net/milkbowl/vault/economy/Economy.java b/src/main/java/net/milkbowl/vault/economy/Economy.java index 5182654..a1b3ed9 100644 --- a/src/main/java/net/milkbowl/vault/economy/Economy.java +++ b/src/main/java/net/milkbowl/vault/economy/Economy.java @@ -250,7 +250,7 @@ public interface Economy { * @param amount Amount to withdraw * @return Detailed response of transaction */ - public EconomyResponse withdrawPlayer(UUID uuid, double amount); + 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. @@ -276,7 +276,7 @@ public interface Economy { * @param amount Amount to withdraw * @return Detailed response of transaction */ - public EconomyResponse withdrawPlayer(UUID uuid, String worldName, double amount); + 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. @@ -300,7 +300,7 @@ public interface Economy { * @param amount Amount to deposit * @return Detailed response of transaction */ - public EconomyResponse depositPlayer(UUID uuid, double amount); + 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. @@ -328,7 +328,7 @@ public interface Economy { * @param amount Amount to deposit * @return Detailed response of transaction */ - public EconomyResponse depositPlayer(UUID uuid, String worldName, double amount); + 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. @@ -465,7 +465,7 @@ public interface Economy { * @param uuid associated with the account * @return if the account creation was successful */ - public boolean createPlayerAccount(UUID uuid); + public boolean createAccount(UUID uuid); /** * @deprecated As of VaultAPI 1.4 use {@link #createPlayerAccount(OfflinePlayer, String)} or {@link #createPlayerAccount(UUID, String)} instead. @@ -489,5 +489,5 @@ public interface Economy { * @param worldName String name of the world * @return if the account creation was successful */ - public boolean createPlayerAccount(UUID uuid, String worldName); + public boolean createAccount(UUID uuid, String worldName); } From e0743da3674fa58874574678b556f97ae54941f0 Mon Sep 17 00:00:00 2001 From: Llm Dl Date: Tue, 12 Oct 2021 08:01:48 -0500 Subject: [PATCH 03/95] Remove the now un-needed AbstractEconomy class. To match the PR I have opened at the Vault repo, which has had the native economy plugin support removed, the VaultAPI plugin no longer requires the AbstractEconomy class. Removal means that this Pull Request no longer calls Bukkit.getOfflinePlayer(uuid), making this much safer. --- .../vault/economy/AbstractEconomy.java | 168 ------------------ 1 file changed, 168 deletions(-) delete mode 100644 src/main/java/net/milkbowl/vault/economy/AbstractEconomy.java 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 af60bc2..0000000 --- a/src/main/java/net/milkbowl/vault/economy/AbstractEconomy.java +++ /dev/null @@ -1,168 +0,0 @@ -package net.milkbowl.vault.economy; - -import java.util.UUID; - -import org.bukkit.Bukkit; -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 boolean hasAccount(UUID uuid) { - if (uuid == null) return false; - return hasAccount(Bukkit.getOfflinePlayer(uuid)); - } - - @Override - public boolean hasAccount(UUID uuid, String worldName) { - if (uuid == null) return false; - return hasAccount(Bukkit.getOfflinePlayer(uuid), worldName); - } - - @Override - public double getBalance(OfflinePlayer player) { - return getBalance(player.getName()); - } - - @Override - public double getBalance(OfflinePlayer player, String worldName) { - return getBalance(player.getName(), worldName); - } - - @Override - public double getBalance(UUID uuid) { - return getBalance(Bukkit.getOfflinePlayer(uuid)); - } - - @Override - public double getBalance(UUID uuid, String worldName) { - return getBalance(Bukkit.getOfflinePlayer(uuid), worldName); - } - - @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 boolean has(UUID uuid, double amount) { - if (uuid == null) return false; - return has(Bukkit.getOfflinePlayer(uuid), amount); - } - - @Override - public boolean has(UUID uuid, String worldName, double amount) { - if (uuid == null) return false; - return has(Bukkit.getOfflinePlayer(uuid), 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 withdraw(UUID uuid, double amount) { - return withdrawPlayer(Bukkit.getOfflinePlayer(uuid), amount); - } - - @Override - public EconomyResponse withdraw(UUID uuid, String worldName, double amount) { - return withdrawPlayer(Bukkit.getOfflinePlayer(uuid), 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 deposit(UUID uuid, double amount) { - return depositPlayer(Bukkit.getOfflinePlayer(uuid), amount); - } - - @Override - public EconomyResponse deposit(UUID uuid, String worldName, double amount) { - return depositPlayer(Bukkit.getOfflinePlayer(uuid), worldName, amount); - } - - @Override - public EconomyResponse createBank(String name, OfflinePlayer player) { - return createBank(name, player.getName()); - } - - @Override - public EconomyResponse createBank(String name, UUID uuid) { - return createBank(name, Bukkit.getOfflinePlayer(uuid)); - } - - @Override - public EconomyResponse isBankOwner(String name, OfflinePlayer player) { - return isBankOwner(name, player.getName()); - } - - @Override - public EconomyResponse isBankOwner(String name, UUID uuid) { - return isBankOwner(name, Bukkit.getOfflinePlayer(uuid)); - } - - @Override - public EconomyResponse isBankMember(String name, OfflinePlayer player) { - return isBankMember(name, player.getName()); - } - - @Override - public EconomyResponse isBankMember(String name, UUID uuid ) { - return isBankMember(name, Bukkit.getOfflinePlayer(uuid)); - } - - @Override - public boolean createPlayerAccount(OfflinePlayer player) { - return createPlayerAccount(player.getName()); - } - - @Override - public boolean createPlayerAccount(OfflinePlayer player, String worldName) { - return createPlayerAccount(player.getName(), worldName); - } - - @Override - public boolean createAccount(UUID uuid) { - return createPlayerAccount(Bukkit.getOfflinePlayer(uuid)); - } - - @Override - public boolean createAccount(UUID uuid, String worldName) { - return createPlayerAccount(Bukkit.getOfflinePlayer(uuid), worldName); - } -} From b1e408be5a829893cf295b3d4575afad45d551c6 Mon Sep 17 00:00:00 2001 From: Llm Dl Date: Mon, 27 Jun 2022 19:23:14 -0500 Subject: [PATCH 04/95] Update pom with tentative version numbering. Add jetbrains annotations & remove mention of specifc economy plugins. --- pom.xml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 5c8c467..1739da8 100644 --- a/pom.xml +++ b/pom.xml @@ -3,12 +3,12 @@ 4.0.0 net.milkbowl.vault VaultAPI - 1.8 + 2.0-SNAPSHOT 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. -Vault currently supports the following: Permissions 3, PEX, GroupManager, bPerms, bPerms2, SimplyPerms, DroxPerms, zPermissions, rscPermissions, KPerms, Starburst, iConomy (4/5/6) BOSEconomy *6/7), EssentialsEcon, 3Co, MultiConomy, MineConomy, EconXP, eWallet, CurrencyCore, XPBank, CraftConomy, AEco, SDFEconomy, TAEcon +Vault currently supports the following: Permissions 3, PEX, GroupManager, bPerms, bPerms2, SimplyPerms, DroxPerms, zPermissions, rscPermissions, KPerms http://dev.bukkit.org/server-mods/vault/ @@ -44,6 +44,10 @@ Vault currently supports the following: Permissions 3, PEX, GroupManager, bPerms spigot-repo https://hub.spigotmc.org/nexus/content/groups/public/ + + central + https://repo1.maven.org/maven2 + @@ -61,6 +65,13 @@ Vault currently supports the following: Permissions 3, PEX, GroupManager, bPerms ${bukkitVersion} provided + + + org.jetbrains + annotations + 23.0.0 + provided + junit From 657069232ecce35feb1b5ca0455345cac0c8f0e2 Mon Sep 17 00:00:00 2001 From: Llm Dl Date: Mon, 27 Jun 2022 19:23:55 -0500 Subject: [PATCH 05/95] Deprecate vault package. --- .../java/net/milkbowl/vault/chat/Chat.java | 1 + .../net/milkbowl/vault/economy/Economy.java | 167 ++---------------- .../vault/economy/EconomyResponse.java | 1 + .../milkbowl/vault/permission/Permission.java | 1 + 4 files changed, 19 insertions(+), 151 deletions(-) diff --git a/src/main/java/net/milkbowl/vault/chat/Chat.java b/src/main/java/net/milkbowl/vault/chat/Chat.java index 2cb2091..1554bb8 100644 --- a/src/main/java/net/milkbowl/vault/chat/Chat.java +++ b/src/main/java/net/milkbowl/vault/chat/Chat.java @@ -24,6 +24,7 @@ /** * The main Chat API - allows for Prefix/Suffix nodes along with generic Info nodes if the linked Chat system supports them * + * @deprecated in lieu of the modern Vault2. To update alter your import to new.milkbowl.vault2.chat. */ public abstract class Chat { diff --git a/src/main/java/net/milkbowl/vault/economy/Economy.java b/src/main/java/net/milkbowl/vault/economy/Economy.java index a1b3ed9..ceb1668 100644 --- a/src/main/java/net/milkbowl/vault/economy/Economy.java +++ b/src/main/java/net/milkbowl/vault/economy/Economy.java @@ -17,13 +17,13 @@ package net.milkbowl.vault.economy; import java.util.List; -import java.util.UUID; import org.bukkit.OfflinePlayer; /** * The main economy API * + * @deprecated in lieu of the modern Vault2. To update alter your import to new.milkbowl.vault2.economy and update to use the new UUID-based methods where available. */ public interface Economy { @@ -81,7 +81,7 @@ public interface Economy { /** * - * @deprecated As of VaultAPI 1.4 use {@link #hasAccount(OfflinePlayer)} or {@link #hasAccount(UUID)} instead. + * @deprecated As of VaultAPI 1.4 use {@link #hasAccount(OfflinePlayer)} instead. */ @Deprecated public boolean hasAccount(String playerName); @@ -97,15 +97,7 @@ public interface Economy { public boolean hasAccount(OfflinePlayer player); /** - * 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 As of VaultAPI 1.4 use {@link #hasAccount(OfflinePlayer, String)} instead. */ @Deprecated public boolean hasAccount(String playerName, String worldName); @@ -122,16 +114,7 @@ public interface Economy { public boolean hasAccount(OfflinePlayer player, String worldName); /** - * 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 As of VaultAPI 1.4 use {@link #getBalance(OfflinePlayer)} instead. */ @Deprecated public double getBalance(String playerName); @@ -145,15 +128,7 @@ public interface Economy { public double getBalance(OfflinePlayer player); /** - * 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 As of VaultAPI 1.4 use {@link #getBalance(OfflinePlayer, String)} instead. */ @Deprecated public double getBalance(String playerName, String world); @@ -168,16 +143,7 @@ public interface Economy { public double getBalance(OfflinePlayer player, String world); /** - * 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 As of VaultAPI 1.4 use {@link #has(OfflinePlayer, double)} instead. */ @Deprecated public boolean has(String playerName, double amount); @@ -192,16 +158,7 @@ public interface Economy { public boolean has(OfflinePlayer player, double amount); /** - * 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 As of VaultAPI 1.4 use {@link #has(OfflinePlayer, String, double)} instead. */ @Deprecated public boolean has(String playerName, String worldName, double amount); @@ -218,18 +175,7 @@ public interface Economy { public boolean has(OfflinePlayer player, String worldName, 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 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 As of VaultAPI 1.4 use {@link #withdrawPlayer(OfflinePlayer, double)} instead. */ @Deprecated public EconomyResponse withdrawPlayer(String playerName, double amount); @@ -244,16 +190,7 @@ public interface Economy { public EconomyResponse withdrawPlayer(OfflinePlayer player, 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); - - /** - * @deprecated As of VaultAPI 1.4 use {@link #withdrawPlayer(OfflinePlayer, String, double)} or {@link #withdrawPlayer(UUID, String, double)} instead. + * @deprecated As of VaultAPI 1.4 use {@link #withdrawPlayer(OfflinePlayer, String, double)} instead. */ @Deprecated public EconomyResponse withdrawPlayer(String playerName, String worldName, double amount); @@ -269,17 +206,7 @@ public interface Economy { public EconomyResponse withdrawPlayer(OfflinePlayer player, String worldName, 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); - - /** - * @deprecated As of VaultAPI 1.4 use {@link #depositPlayer(OfflinePlayer, double)} or {@link #depositPlayer(UUID, double)} instead. + * @deprecated As of VaultAPI 1.4 use {@link #depositPlayer(OfflinePlayer, double)} instead. */ @Deprecated public EconomyResponse depositPlayer(String playerName, double amount); @@ -294,16 +221,7 @@ public interface Economy { public EconomyResponse depositPlayer(OfflinePlayer player, 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); - - /** - * @deprecated As of VaultAPI 1.4 use {@link #depositPlayer(OfflinePlayer, String, double)} or {@link #depositPlayer(UUID, String, double)} instead. + * @deprecated As of VaultAPI 1.4 use {@link #depositPlayer(OfflinePlayer, String, double)} instead. */ @Deprecated public EconomyResponse depositPlayer(String playerName, String worldName, double amount); @@ -320,18 +238,7 @@ public interface Economy { public EconomyResponse depositPlayer(OfflinePlayer player, String worldName, 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); - - /** - * @deprecated As of VaultAPI 1.4 use {@link #createBank(String, OfflinePlayer)} or {@link #createBank(String, UUID)} instead. + * @deprecated As of VaultAPI 1.4 use {{@link #createBank(String, OfflinePlayer)} instead. */ @Deprecated public EconomyResponse createBank(String name, String player); @@ -343,14 +250,6 @@ 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. @@ -394,7 +293,7 @@ public interface Economy { public EconomyResponse bankDeposit(String name, double amount); /** - * @deprecated As of VaultAPI 1.4 use {@link #isBankOwner(String, OfflinePlayer)} or {@link #isBankOwner(String, UUID)} instead. + * @deprecated As of VaultAPI 1.4 use {{@link #isBankOwner(String, OfflinePlayer)} instead. */ @Deprecated public EconomyResponse isBankOwner(String name, String playerName); @@ -407,18 +306,9 @@ 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)} or {@link #isBankMember(String, UUID)} instead. + * @deprecated As of VaultAPI 1.4 use {@link #isBankMember(String, OfflinePlayer)} instead. */ @Deprecated public EconomyResponse isBankMember(String name, String playerName); @@ -431,15 +321,6 @@ 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 @@ -448,7 +329,7 @@ public interface Economy { public List getBanks(); /** - * @deprecated As of VaultAPI 1.4 use {@link #createPlayerAccount(OfflinePlayer)} or {@link #createPlayerAccount(UUID)} instead. + * @deprecated As of VaultAPI 1.4 use {@link #createPlayerAccount(OfflinePlayer)} instead. */ @Deprecated public boolean createPlayerAccount(String playerName); @@ -461,14 +342,7 @@ public interface Economy { public boolean createPlayerAccount(OfflinePlayer player); /** - * 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 As of VaultAPI 1.4 use {@link #createPlayerAccount(OfflinePlayer, String)} instead. */ @Deprecated public boolean createPlayerAccount(String playerName, String worldName); @@ -481,13 +355,4 @@ 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); } diff --git a/src/main/java/net/milkbowl/vault/economy/EconomyResponse.java b/src/main/java/net/milkbowl/vault/economy/EconomyResponse.java index 508e2fd..2b6519e 100644 --- a/src/main/java/net/milkbowl/vault/economy/EconomyResponse.java +++ b/src/main/java/net/milkbowl/vault/economy/EconomyResponse.java @@ -20,6 +20,7 @@ * It includes a {@link ResponseType} indicating whether the plugin currently being used for Economy actually allows * the method, or if the operation was a success or failure. * + * @deprecated in lieu of the modern Vault2. To update alter your import to new.milkbowl.vault2.economy. */ public class EconomyResponse { diff --git a/src/main/java/net/milkbowl/vault/permission/Permission.java b/src/main/java/net/milkbowl/vault/permission/Permission.java index 0f68eba..9d15318 100644 --- a/src/main/java/net/milkbowl/vault/permission/Permission.java +++ b/src/main/java/net/milkbowl/vault/permission/Permission.java @@ -28,6 +28,7 @@ /** * The main Permission API - allows for group and player based permission tests * + * @deprecated in lieu of the modern Vault2. To update alter your import to new.milkbowl.vault2.permission. */ public abstract class Permission { From 5348352f5de7a7e32e1fcf1f5c96cd17abc1f5a8 Mon Sep 17 00:00:00 2001 From: Llm Dl Date: Mon, 27 Jun 2022 19:30:54 -0500 Subject: [PATCH 06/95] Add vault2 package. All classes are the same as their v1 selves. --- .../java/net/milkbowl/vault2/chat/Chat.java | 995 ++++++++++++++++++ .../vault2/economy/EconomyResponse.java | 89 ++ .../vault2/permission/Permission.java | 705 +++++++++++++ 3 files changed, 1789 insertions(+) create mode 100644 src/main/java/net/milkbowl/vault2/chat/Chat.java create mode 100644 src/main/java/net/milkbowl/vault2/economy/EconomyResponse.java create mode 100644 src/main/java/net/milkbowl/vault2/permission/Permission.java diff --git a/src/main/java/net/milkbowl/vault2/chat/Chat.java b/src/main/java/net/milkbowl/vault2/chat/Chat.java new file mode 100644 index 0000000..7c48870 --- /dev/null +++ b/src/main/java/net/milkbowl/vault2/chat/Chat.java @@ -0,0 +1,995 @@ +/* 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 . +*/ +package net.milkbowl.vault2.chat; + +import net.milkbowl.vault2.permission.Permission; + +import org.bukkit.OfflinePlayer; +import org.bukkit.World; +import org.bukkit.entity.Player; + +/** + * The main Chat API - allows for Prefix/Suffix nodes along with generic Info nodes if the linked Chat system supports them + * + */ +public abstract class Chat { + + private Permission perms; + + public Chat(Permission perms) { + this.perms = perms; + } + /** + * Gets name of permission method + * @return Name of Permission Method + */ + abstract public String getName(); + + /** + * Checks if permission method is enabled. + * @return Success or Failure + */ + abstract public boolean isEnabled(); + + /** + * @deprecated As of VaultAPI 1.4 use {{@link #getPlayerPrefix(String, OfflinePlayer)} instead. + * + * Get players prefix + * @param world World name + * @param player Player name + * @return Prefix + */ + @Deprecated + abstract public String getPlayerPrefix(String world, String player); + + /** + * Get a players prefix in the given world + * Use NULL for world if requesting a global prefix + * + * @param world World name + * @param player OfflinePlayer + * @return Prefix + */ + public String getPlayerPrefix(String world, OfflinePlayer player) { + return getPlayerPrefix(world, player.getName()); + } + + /** + * @deprecated As of VaultAPI 1.4 use {{@link #getPlayerPrefix(String, OfflinePlayer)} instead. + * + * Get players prefix + * @param world World Object + * @param player Player name + * @return Prefix + */ + @Deprecated + public String getPlayerPrefix(World world, String player) { + return getPlayerPrefix(world.getName(), player); + } + + /** + * Get players prefix from the world they are currently in. + * May or may not return the global prefix depending on implementation. + * + * @param player Player Object + * @return Prefix + */ + public String getPlayerPrefix(Player player) { + return getPlayerPrefix(player.getWorld().getName(), player); + } + + /** + * @deprecated As of VaultAPI 1.4 use {{@link #setPlayerPrefix(String, OfflinePlayer, String)} instead. + * + * Set players prefix + * @param world World name + * @param player Player name + * @param prefix Prefix + */ + @Deprecated + abstract public void setPlayerPrefix(String world, String player, String prefix); + + /** + * Sets players prefix in the given world. + * Use NULL for world for setting in the Global scope. + * + * @param world World name + * @param player OfflinePlayer + * @param prefix Prefix + */ + public void setPlayerPrefix(String world, OfflinePlayer player, String prefix) { + setPlayerPrefix(world, player.getName(), prefix); + } + + /** + * @deprecated As of VaultAPI 1.4 use {{@link #setPlayerPrefix(String, OfflinePlayer, String)} instead. + * + * Set players prefix in the given world. + * + * @param world World Object + * @param player Player name + * @param prefix Prefix + */ + @Deprecated + public void setPlayerPrefix(World world, String player, String prefix) { + setPlayerPrefix(world.getName(), player, prefix); + } + + /** + * Set players prefix in the world they are currently in. + * + * @param player Player Object + * @param prefix Prefix + */ + public void setPlayerPrefix(Player player, String prefix) { + setPlayerPrefix(player.getWorld().getName(), player, prefix); + } + + /** + * @deprecated As of VaultAPI 1.4 use {{@link #getPlayerSuffix(String, OfflinePlayer)} instead. + * + * Get players suffix + * @param world World name + * @param player Player name + * @return Suffix + */ + @Deprecated + abstract public String getPlayerSuffix(String world, String player); + + /** + * Get players suffix in the specified world. + * + * @param world World name + * @param player OfflinePlayer name + * @return Suffix + */ + public String getPlayerSuffix(String world, OfflinePlayer player) { + return getPlayerSuffix(world, player.getName()); + } + + /** + * @deprecated As of VaultAPI 1.4 use {{@link #getPlayerSuffix(String, OfflinePlayer)} instead. + * + * Get players suffix + * @param world World Object + * @param player Player name + * @return Suffix + */ + @Deprecated + public String getPlayerSuffix(World world, String player) { + return getPlayerSuffix(world.getName(), player); + } + + /** + * Get players suffix in the world they are currently in. + * + * @param player Player Object + * @return Suffix + */ + public String getPlayerSuffix(Player player) { + return getPlayerSuffix(player.getWorld().getName(), player); + } + + /** + * @deprecated As of VaultAPI 1.4 use {{@link #setPlayerSuffix(String, OfflinePlayer, String)} instead. + * + * Set players suffix + * @param world World name + * @param player Player name + * @param suffix Suffix + */ + @Deprecated + abstract public void setPlayerSuffix(String world, String player, String suffix); + + /** + * Set players suffix for the world specified + * + * @param world World name + * @param player OfflinePlayer + * @param suffix Suffix + */ + public void setPlayerSuffix(String world, OfflinePlayer player, String suffix) { + setPlayerSuffix(world, player.getName(), suffix); + } + + /** + * @deprecated As of VaultAPI 1.4 use {{@link #setPlayerSuffix(String, OfflinePlayer, String)} instead. + * + * Set players suffix + * @param world World Object + * @param player Player name + * @param suffix Suffix + */ + @Deprecated + public void setPlayerSuffix(World world, String player, String suffix) { + setPlayerSuffix(world.getName(), player, suffix); + } + + /** + * Set players suffix in the world they currently occupy. + * + * @param player Player Object + * @param suffix Suffix + */ + public void setPlayerSuffix(Player player, String suffix) { + setPlayerSuffix(player.getWorld().getName(), player, suffix); + } + + /** + * Get group prefix + * @param world World name + * @param group Group name + * @return Prefix + */ + abstract public String getGroupPrefix(String world, String group); + + /** + * Get group prefix + * @param world World Object + * @param group Group name + * @return Prefix + */ + public String getGroupPrefix(World world, String group) { + return getGroupPrefix(world.getName(), group); + } + + /** + * Set group prefix + * @param world World name + * @param group Group name + * @param prefix Prefix + */ + abstract public void setGroupPrefix(String world, String group, String prefix); + + /** + * Set group prefix + * @param world World Object + * @param group Group name + * @param prefix Prefix + */ + public void setGroupPrefix(World world, String group, String prefix) { + setGroupPrefix(world.getName(), group, prefix); + } + + /** + * Get group suffix + * @param world World name + * @param group Group name + * @return Suffix + */ + abstract public String getGroupSuffix(String world, String group); + + /** + * Get group suffix + * @param world World Object + * @param group Group name + * @return Suffix + */ + public String getGroupSuffix(World world, String group) { + return getGroupSuffix(world.getName(), group); + } + + /** + * Set group suffix + * @param world World name + * @param group Group name + * @param suffix Suffix + */ + abstract public void setGroupSuffix(String world, String group, String suffix); + + /** + * Set group suffix + * @param world World Object + * @param group Group name + * @param suffix Suffix + */ + public void setGroupSuffix(World world, String group, String suffix) { + setGroupSuffix(world.getName(), group, suffix); + } + + /** + * Get a players informational node (Integer) value + * @param world World name + * @param player OfflinePlayer + * @param node Permission node + * @param defaultValue Default value + * @return Value + */ + public int getPlayerInfoInteger(String world, OfflinePlayer player, String node, int defaultValue) { + return getPlayerInfoInteger(world, player.getName(), node, defaultValue); + } + + /** + * @deprecated As of VaultAPI 1.4 use {{@link #getPlayerInfoInteger(String, OfflinePlayer, String, int)} instead. + * Get a players informational node (Integer) value + * @param world World name + * @param player Player name + * @param node Permission node + * @param defaultValue Default value + * @return Value + */ + @Deprecated + abstract public int getPlayerInfoInteger(String world, String player, String node, int defaultValue); + + /** + * @deprecated As of VaultAPI 1.4 use {{@link #getPlayerInfoInteger(String, OfflinePlayer, String, int)} instead. + * + * Get a players informational node (Integer) value + * @param world World Object + * @param player Player name + * @param node Permission node + * @param defaultValue Default value + * @return Value + */ + @Deprecated + public int getPlayerInfoInteger(World world, String player, String node, int defaultValue) { + return getPlayerInfoInteger(world.getName(), player, node, defaultValue); + } + + /** + * Get a players informational node (Integer) value + * @param player Player Object + * @param node Permission node + * @param defaultValue Default value + * @return Value + */ + public int getPlayerInfoInteger(Player player, String node, int defaultValue) { + return getPlayerInfoInteger(player.getWorld().getName(), player, node, defaultValue); + } + + /** + * Set a players informational node (Integer) value + * @param world World name + * @param player OfflinePlayer + * @param node Permission node + * @param value Value to set + */ + public void setPlayerInfoInteger(String world, OfflinePlayer player, String node, int value) { + setPlayerInfoInteger(world, player.getName(), node, value); + } + + /** + * @deprecated As of VaultAPI 1.4 use {{@link #setPlayerInfoInteger(String, OfflinePlayer, String, int)} instead. + * + * Set a players informational node (Integer) value + * @param world World name + * @param player Player name + * @param node Permission node + * @param value Value to set + */ + @Deprecated + abstract public void setPlayerInfoInteger(String world, String player, String node, int value); + + /** + * @deprecated As of VaultAPI 1.4 use {{@link #setPlayerInfoInteger(String, OfflinePlayer, String, int)} instead. + * + * Set a players informational node (Integer) value + * @param world World Object + * @param player Player name + * @param node Permission node + * @param value Value to set + */ + @Deprecated + public void setPlayerInfoInteger(World world, String player, String node, int value) { + setPlayerInfoInteger(world.getName(), player, node, value); + } + + /** + * Set a players informational node (Integer) value + * @param player Player Object + * @param node Permission node + * @param value Value to set + */ + public void setPlayerInfoInteger(Player player, String node, int value) { + setPlayerInfoInteger(player.getWorld().getName(), player, node, value); + } + + /** + * Get a groups informational node (Integer) value + * @param world World name + * @param group Group name + * @param node Permission node + * @param defaultValue Default value + * @return Value + */ + abstract public int getGroupInfoInteger(String world, String group, String node, int defaultValue); + + /** + * Get a groups informational node (Integer) value + * @param world World Object + * @param group Group name + * @param node Permission node + * @param defaultValue Default value + * @return Value + */ + public int getGroupInfoInteger(World world, String group, String node, int defaultValue) { + return getGroupInfoInteger(world.getName(), group, node, defaultValue); + } + + /** + * Set a groups informational node (Integer) value + * @param world World name + * @param group Group name + * @param node Permission node + * @param value Value to set + */ + abstract public void setGroupInfoInteger(String world, String group, String node, int value); + + /** + * Set a groups informational node (Integer) value + * @param world World Object + * @param group Group name + * @param node Permission node + * @param value Value to set + */ + public void setGroupInfoInteger(World world, String group, String node, int value) { + setGroupInfoInteger(world.getName(), group, node, value); + } + + /** + * Get a players informational node (Double) value + * @param world World name + * @param player OfflinePlayer + * @param node Permission node + * @param defaultValue Default value + * @return Value + */ + public double getPlayerInfoDouble(String world, OfflinePlayer player, String node, double defaultValue) { + return getPlayerInfoDouble(world, player.getName(), node, defaultValue); + } + + /** + * @deprecated As of VaultAPI 1.4 use {{@link #getPlayerInfoDouble(String, OfflinePlayer, String, double)} instead. + * + * Get a players informational node (Double) value + * @param world World name + * @param player Player name + * @param node Permission node + * @param defaultValue Default value + * @return Value + */ + @Deprecated + abstract public double getPlayerInfoDouble(String world, String player, String node, double defaultValue); + + /** + * @deprecated As of VaultAPI 1.4 use {{@link #getPlayerInfoDouble(String, OfflinePlayer, String, double)} instead + * + * Get a players informational node (Double) value + * @param world World Object + * @param player Player name + * @param node Permission node + * @param defaultValue Default value + * @return Value + */ + @Deprecated + public double getPlayerInfoDouble(World world, String player, String node, double defaultValue) { + return getPlayerInfoDouble(world.getName(), player, node, defaultValue); + } + + /** + * Get a players informational node (Double) value + * @param player Player Object + * @param node Permission node + * @param defaultValue Default value + * @return Value + */ + public double getPlayerInfoDouble(Player player, String node, double defaultValue) { + return getPlayerInfoDouble(player.getWorld().getName(), player, node, defaultValue); + } + + /** + * Set a players informational node (Double) value + * @param world World name + * @param player OfflinePlayer + * @param node Permission node + * @param value Value to set + */ + public void setPlayerInfoDouble(String world, OfflinePlayer player, String node, double value) { + setPlayerInfoDouble(world, player.getName(), node, value); + } + + /** + * @deprecated As of VaultAPI 1.4 use {{@link #setPlayerInfoDouble(String, OfflinePlayer, String, double)} instead. + * Set a players informational node (Double) value + * @param world World name + * @param player Player name + * @param node Permission node + * @param value Value to set + */ + @Deprecated + abstract public void setPlayerInfoDouble(String world, String player, String node, double value); + + /** + * @deprecated As of VaultAPI 1.4 use {{@link #setPlayerInfoDouble(String, OfflinePlayer, String, double)} instead. + * Set a players informational node (Double) value + * @param world World Object + * @param player Player name + * @param node Permission node + * @param value Value to set + */ + @Deprecated + public void setPlayerInfoDouble(World world, String player, String node, double value) { + setPlayerInfoDouble(world.getName(), player, node, value); + } + + /** + * Set a players informational node (Double) value + * @param player Player Object + * @param node Permission node + * @param value Value to set + */ + public void setPlayerInfoDouble(Player player, String node, double value) { + setPlayerInfoDouble(player.getWorld().getName(), player, node, value); + } + + /** + * Get a groups informational node (Double) value + * @param world World name + * @param group Group name + * @param node Permission node + * @param defaultValue Default value + * @return Value + */ + abstract public double getGroupInfoDouble(String world, String group, String node, double defaultValue); + + /** + * Get a groups informational node (Double) value + * @param world World Object + * @param group Group name + * @param node Permission node + * @param defaultValue Default value + * @return Value + */ + public double getGroupInfoDouble(World world, String group, String node, double defaultValue) { + return getGroupInfoDouble(world.getName(), group, node, defaultValue); + } + + /** + * Set a groups informational node (Double) value + * @param world World name + * @param group Group name + * @param node Permission node + * @param value Value to set + */ + abstract public void setGroupInfoDouble(String world, String group, String node, double value); + + /** + * Set a groups informational node (Double) value + * @param world World Object + * @param group Group name + * @param node Permission node + * @param value Value to set + */ + public void setGroupInfoDouble(World world, String group, String node, double value) { + setGroupInfoDouble(world.getName(), group, node, value); + } + + /** + * Get a players informational node (Boolean) value + * @param world World name + * @param player OfflinePlayer + * @param node Permission node + * @param defaultValue Default value + * @return Value + */ + public boolean getPlayerInfoBoolean(String world, OfflinePlayer player, String node, boolean defaultValue) { + return getPlayerInfoBoolean(world, player.getName(), node, defaultValue); + } + + /** + * @deprecated As of VaultAPI 1.4 use {{@link #getPlayerInfoBoolean(String, OfflinePlayer, String, boolean)} instead. + * + * Get a players informational node (Boolean) value + * @param world World name + * @param player Player name + * @param node Permission node + * @param defaultValue Default value + * @return Value + */ + @Deprecated + abstract public boolean getPlayerInfoBoolean(String world, String player, String node, boolean defaultValue); + + /** + * @deprecated As of VaultAPI 1.4 use {{@link #getPlayerInfoBoolean(String, OfflinePlayer, String, boolean)} instead. + * + * Get a players informational node (Boolean) value + * @param world World Object + * @param player Player name + * @param node Permission node + * @param defaultValue Default value + * @return Value + */ + @Deprecated + public boolean getPlayerInfoBoolean(World world, String player, String node, boolean defaultValue) { + return getPlayerInfoBoolean(world.getName(), player, node, defaultValue); + } + + /** + * Get a players informational node (Boolean) value + * @param player Player Object + * @param node Permission node + * @param defaultValue Default value + * @return Value + */ + public boolean getPlayerInfoBoolean(Player player, String node, boolean defaultValue) { + return getPlayerInfoBoolean(player.getWorld().getName(), player, node, defaultValue); + } + + /** + * Set a players informational node (Boolean) value + * @param world World name + * @param player OfflinePlayer + * @param node Permission node + * @param value Value to set + */ + public void setPlayerInfoBoolean(String world, OfflinePlayer player, String node, boolean value) { + setPlayerInfoBoolean(world, player.getName(), node, value); + } + + /** + * @deprecated As of VaultAPI 1.4 use {{@link #setPlayerInfoBoolean(String, OfflinePlayer, String, boolean)} instead. + * Set a players informational node (Boolean) value + * @param world World name + * @param player Player name + * @param node Permission node + * @param value Value to set + */ + @Deprecated + abstract public void setPlayerInfoBoolean(String world, String player, String node, boolean value); + + /** + * @deprecated As of VaultAPI 1.4 use {{@link #setPlayerInfoBoolean(String, OfflinePlayer, String, boolean)} instead. + * Set a players informational node (Boolean) value + * @param world World Object + * @param player Player name + * @param node Permission node + * @param value Value to set + */ + @Deprecated + public void setPlayerInfoBoolean(World world, String player, String node, boolean value) { + setPlayerInfoBoolean(world.getName(), player, node, value); + } + + /** + * Set a players informational node (Boolean) value + * @param player Player Object + * @param node Permission node + * @param value Value to set + */ + public void setPlayerInfoBoolean(Player player, String node, boolean value) { + setPlayerInfoBoolean(player.getWorld().getName(), player, node, value); + } + + /** + * Get a groups informational node (Boolean) value + * @param world Name of World + * @param group Name of Group + * @param node Permission node + * @param defaultValue Default value + * @return Value + */ + abstract public boolean getGroupInfoBoolean(String world, String group, String node, boolean defaultValue); + + /** + * Set a players informational node (Boolean) value + * @param world World Object + * @param group Group name + * @param node Permission node + * @param defaultValue Default value + * @return Value + */ + public boolean getGroupInfoBoolean(World world, String group, String node, boolean defaultValue) { + return getGroupInfoBoolean(world.getName(), group, node, defaultValue); + } + + /** + * Set a groups informational node (Boolean) value + * @param world World name + * @param group Group name + * @param node Permission node + * @param value Value to set + */ + abstract public void setGroupInfoBoolean(String world, String group, String node, boolean value); + + /** + * Set a players informational node (Boolean) value + * @param world World Object + * @param group Group name + * @param node Permission node + * @param value Value to set + */ + public void setGroupInfoBoolean(World world, String group, String node, boolean value) { + setGroupInfoBoolean(world.getName(), group, node, value); + } + + /** + * Get a players informational node (String) value + * @param world World name + * @param player OfflinePlayer + * @param node Permission node + * @param defaultValue Default value + * @return Value + */ + public String getPlayerInfoString(String world, OfflinePlayer player, String node, String defaultValue) { + return getPlayerInfoString(world, player.getName(), node, defaultValue); + } + + /** + * @deprecated As of VaultAPI 1.4 use {{@link #getPlayerInfoString(String, OfflinePlayer, String, String)} instead. + * + * Get a players informational node (String) value + * @param world World name + * @param player Player name + * @param node Permission node + * @param defaultValue Default value + * @return Value + */ + @Deprecated + abstract public String getPlayerInfoString(String world, String player, String node, String defaultValue); + + /** + * @deprecated As of VaultAPI 1.4 use {{@link #getPlayerInfoString(String, OfflinePlayer, String, String)} instead. + * Get a players informational node (String) value + * @param world World Object + * @param player Player name + * @param node Permission node + * @param defaultValue Default value + * @return Value + */ + @Deprecated + public String getPlayerInfoString(World world, String player, String node, String defaultValue) { + return getPlayerInfoString(world.getName(), player, node, defaultValue); + } + + /** + * Get a players informational node (String) value + * @param player Player Object + * @param node Permission node + * @param defaultValue Default value + * @return Value + */ + public String getPlayerInfoString(Player player, String node, String defaultValue) { + return getPlayerInfoString(player.getWorld().getName(), player, node, defaultValue); + } + + /** + * Set a players informational node (String) value + * @param world World name + * @param player OfflinePlayer + * @param node Permission node + * @param value Value to set + */ + public void setPlayerInfoString(String world, OfflinePlayer player, String node, String value) { + setPlayerInfoString(world, player.getName(), node, value); + } + + /** + * @deprecated As of VaultAPI 1.4 use {{@link #setPlayerInfoString(String, OfflinePlayer, String, String)} instead. + * Set a players informational node (String) value + * @param world World name + * @param player Player name + * @param node Permission node + * @param value Value to set + */ + @Deprecated + abstract public void setPlayerInfoString(String world, String player, String node, String value); + + /** + * @deprecated As of VaultAPI 1.4 use {{@link #setPlayerInfoString(String, OfflinePlayer, String, String)} instead. + * Set a players informational node (String) value + * @param world World name + * @param player Player name + * @param node Permission node + * @param value Value to set + */ + @Deprecated + public void setPlayerInfoString(World world, String player, String node, String value) { + setPlayerInfoString(world.getName(), player, node, value); + } + + /** + * Set a players informational node (String) value + * @param player Player Object + * @param node Permission node + * @param value Value ot set + */ + public void setPlayerInfoString(Player player, String node, String value) { + setPlayerInfoString(player.getWorld().getName(), player, node, value); + } + + /** + * Get a groups informational node (String) value + * @param world Name of World + * @param group Name of Group + * @param node Permission node + * @param defaultValue Default value + * @return Value + */ + abstract public String getGroupInfoString(String world, String group, String node, String defaultValue); + + /** + * Set a players informational node (String) value + * @param world World Object + * @param group Group name + * @param node Permission node + * @param defaultValue Default value + * @return Value + */ + public String getGroupInfoString(World world, String group, String node, String defaultValue) { + return getGroupInfoString(world.getName(), group, node, defaultValue); + } + + /** + * Set a groups informational node (String) value + * @param world World name + * @param group Group name + * @param node Permission node + * @param value Value to set + */ + abstract public void setGroupInfoString(String world, String group, String node, String value); + + /** + * Set a groups informational node (String) value + * @param world World name + * @param group Group name + * @param node Permission node + * @param value Value to set + */ + public void setGroupInfoString(World world, String group, String node, String value) { + setGroupInfoString(world.getName(), group, node, value); + } + + /** + * Check if player is member of a group. + * @param world World name + * @param player OfflinePlayer + * @param group Group name + * @return Success or Failure + */ + public boolean playerInGroup(String world, OfflinePlayer player, String group) { + return perms.playerInGroup(world, player, group); + } + + /** + * @deprecated As of VaultAPI 1.4 use {{@link #playerInGroup(String, OfflinePlayer, String)} instead. + * Check if player is member of a group. + * @param world World name + * @param player Player name + * @param group Group name + * @return Success or Failure + */ + @Deprecated + public boolean playerInGroup(String world, String player, String group) { + return perms.playerInGroup(world, player, group); + } + + /** + * @deprecated As of VaultAPI 1.4 use {{@link #playerInGroup(String, OfflinePlayer, String)} instead. + * Check if player is member of a group. + * @param world World Object + * @param player Player name + * @param group Group name + * @return Success or Failure + */ + @Deprecated + public boolean playerInGroup(World world, String player, String group) { + return playerInGroup(world.getName(), player, group); + } + + /** + * Check if player is member of a group. + * @param player Player Object + * @param group Group name + * @return Success or Failure + */ + public boolean playerInGroup(Player player, String group) { + return playerInGroup(player.getWorld().getName(), player, group); + } + + /** + * Gets the list of groups that this player has + * @param world World name + * @param player OfflinePlayer + * @return Array of groups + */ + public String[] getPlayerGroups(String world, OfflinePlayer player) { + return perms.getPlayerGroups(world, player); + } + + /** + * @deprecated As of VaultAPI 1.4 use {{@link #getPlayerGroups(String, OfflinePlayer)} instead. + * Gets the list of groups that this player has + * @param world World name + * @param player Player name + * @return Array of groups + */ + @Deprecated + public String[] getPlayerGroups(String world, String player) { + return perms.getPlayerGroups(world, player); + } + + /** + * @deprecated As of VaultAPI 1.4 use {{@link #getPlayerGroups(String, OfflinePlayer)} instead. + * Gets the list of groups that this player has + * @param world World Object + * @param player Player name + * @return Array of groups + */ + @Deprecated + public String[] getPlayerGroups(World world, String player) { + return getPlayerGroups(world.getName(), player); + } + + /** + * Gets the list of groups that this player has + * @param player Player Object + * @return Array of groups + */ + public String[] getPlayerGroups(Player player) { + return getPlayerGroups(player.getWorld().getName(), player); + } + + /** + * Gets players primary group + * @param world World name + * @param player OfflinePlayer + * @return Players primary group + */ + public String getPrimaryGroup(String world, OfflinePlayer player) { + return perms.getPrimaryGroup(world, player); + } + + /** + * @deprecated As of VaultAPI 1.4 use {{@link #getPrimaryGroup(String, OfflinePlayer)} instead. + * Gets players primary group + * @param world World name + * @param player Player name + * @return Players primary group + */ + @Deprecated + public String getPrimaryGroup(String world, String player) { + return perms.getPrimaryGroup(world, player); + } + + /** + * @deprecated As of VaultAPI 1.4 use {{@link #getPrimaryGroup(String, OfflinePlayer)} instead. + * Gets players primary group + * @param world World Object + * @param player Player name + * @return Players primary group + */ + @Deprecated + public String getPrimaryGroup(World world, String player) { + return getPrimaryGroup(world.getName(), player); + } + + /** + * Get players primary group + * @param player Player Object + * @return Players primary group + */ + public String getPrimaryGroup(Player player) { + return getPrimaryGroup(player.getWorld().getName(), player); + } + + /** + * Returns a list of all known groups + * @return an Array of String of all groups + */ + public String[] getGroups() { + return perms.getGroups(); + } +} diff --git a/src/main/java/net/milkbowl/vault2/economy/EconomyResponse.java b/src/main/java/net/milkbowl/vault2/economy/EconomyResponse.java new file mode 100644 index 0000000..f920491 --- /dev/null +++ b/src/main/java/net/milkbowl/vault2/economy/EconomyResponse.java @@ -0,0 +1,89 @@ +/* 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 . + */ +package net.milkbowl.vault2.economy; + +/** + * Indicates a typical Return for an Economy method. + * It includes a {@link ResponseType} indicating whether the plugin currently being used for Economy actually allows + * the method, or if the operation was a success or failure. + * + */ +public class EconomyResponse { + + /** + * Enum for types of Responses indicating the status of a method call. + */ + public static enum ResponseType { + SUCCESS(1), + FAILURE(2), + NOT_IMPLEMENTED(3); + + private int id; + + ResponseType(int id) { + this.id = id; + } + + int getId() { + return id; + } + } + + /** + * Amount modified by calling method + */ + public final double amount; + /** + * New balance of account + */ + public final double balance; + /** + * Success or failure of call. Using Enum of ResponseType to determine valid + * outcomes + */ + public final ResponseType type; + /** + * Error message if the variable 'type' is ResponseType.FAILURE + */ + public final String errorMessage; + + /** + * Constructor for EconomyResponse + * @param amount Amount modified during operation + * @param balance New balance of account + * @param type Success or failure type of the operation + * @param errorMessage Error message if necessary (commonly null) + */ + public EconomyResponse(double amount, double balance, ResponseType type, String errorMessage) { + this.amount = amount; + this.balance = balance; + this.type = type; + this.errorMessage = errorMessage; + } + + /** + * Checks if an operation was successful + * @return Value + */ + public boolean transactionSuccess() { + switch (type) { + case SUCCESS: + return true; + default: + return false; + } + } +} \ No newline at end of file diff --git a/src/main/java/net/milkbowl/vault2/permission/Permission.java b/src/main/java/net/milkbowl/vault2/permission/Permission.java new file mode 100644 index 0000000..d602278 --- /dev/null +++ b/src/main/java/net/milkbowl/vault2/permission/Permission.java @@ -0,0 +1,705 @@ +/* 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 . + */ +package net.milkbowl.vault2.permission; + +import java.util.logging.Logger; + +import org.bukkit.OfflinePlayer; +import org.bukkit.World; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; +import org.bukkit.permissions.PermissionAttachment; +import org.bukkit.permissions.PermissionAttachmentInfo; +import org.bukkit.plugin.Plugin; + +/** + * The main Permission API - allows for group and player based permission tests + * + */ +public abstract class Permission { + + protected static final Logger log = Logger.getLogger("Minecraft"); + protected Plugin plugin = null; + + /** + * Gets name of permission method + * @return Name of Permission Method + */ + abstract public String getName(); + + /** + * Checks if permission method is enabled. + * @return Success or Failure + */ + abstract public boolean isEnabled(); + + /** + * Returns if the permission system is or attempts to be compatible with super-perms. + * @return True if this permission implementation works with super-perms + */ + abstract public boolean hasSuperPermsCompat(); + + /** + * @deprecated As of VaultAPI 1.4 use {@link #playerHas(String, OfflinePlayer, String)} instead. + */ + @Deprecated + public boolean has(String world, String player, String permission) { + if (world == null) { + return playerHas((String) null, player, permission); + } + return playerHas(world, player, permission); + } + + /** + * @deprecated As of VaultAPI 1.4 use {@link #playerHas(String, OfflinePlayer, String)} instead. + */ + @Deprecated + public boolean has(World world, String player, String permission) { + if (world == null) { + return playerHas((String) null, player, permission); + } + return playerHas(world.getName(), player, permission); + } + + /** + * Checks if a CommandSender has a permission node. + * This will return the result of bukkits, generic .hasPermission() method and is identical in all cases. + * This method will explicitly fail if the registered permission system does not register permissions in bukkit. + * + * For easy checking of a commandsender + * @param sender to check permissions on + * @param permission to check for + * @return true if the sender has the permission + */ + public boolean has(CommandSender sender, String permission) { + return sender.hasPermission(permission); + } + + /** + * Checks if player has a permission node. (Short for playerHas(...) + * @param player Player Object + * @param permission Permission node + * @return Success or Failure + */ + public boolean has(Player player, String permission) { + return player.hasPermission(permission); + } + + /** + * @deprecated As of VaultAPI 1.4 use {@link #playerHas(String, OfflinePlayer, String)} instead. + */ + @Deprecated + abstract public boolean playerHas(String world, String player, String permission); + + /** + * @deprecated As of VaultAPI 1.4 use {@link #playerHas(String, OfflinePlayer, String)} instead. + */ + @Deprecated + public boolean playerHas(World world, String player, String permission) { + if (world == null) { + return playerHas((String) null, player, permission); + } + return playerHas(world.getName(), player, permission); + } + + /** + * Checks if player has a permission node. + * Supports NULL value for World if the permission system registered supports global permissions. + * But May return odd values if the servers registered permission system does not have a global permission store. + * + * @param world String world name + * @param player to check + * @param permission Permission node + * @return Success or Failure + */ + public boolean playerHas(String world, OfflinePlayer player, String permission) { + if (world == null) { + return has((String) null, player.getName(), permission); + } + return has(world, player.getName(), permission); + } + + /** + * Checks if player has a permission node. + * Defaults to world-specific permission check if the permission system supports it. + * See {@link #playerHas(String, OfflinePlayer, String)} for explicit global or world checks. + * + * @param player Player Object + * @param permission Permission node + * @return Success or Failure + */ + public boolean playerHas(Player player, String permission) { + return has(player, permission); + } + + /** + * @deprecated As of VaultAPI 1.4 use {@link #playerAdd(String, OfflinePlayer, String)} instead. + * Add permission to a player. + * Supports NULL value for World if the permission system registered supports global permissions. + * But May return odd values if the servers registered permission system does not have a global permission store. + * + * @param world World name + * @param player Player name + * @param permission Permission node + * @return Success or Failure + */ + @Deprecated + abstract public boolean playerAdd(String world, String player, String permission); + + /** + * @deprecated As of VaultAPI 1.4 use {@link #playerAdd(String, OfflinePlayer, String)} instead. + */ + @Deprecated + public boolean playerAdd(World world, String player, String permission) { + if (world == null) { + return playerAdd((String) null, player, permission); + } + return playerAdd(world.getName(), player, permission); + } + + /** + * Add permission to a player. + * Supports NULL value for World if the permission system registered supports global permissions. + * But May return odd values if the servers registered permission system does not have a global permission store. + * + * @param world String world name + * @param player to add to + * @param permission Permission node + * @return Success or Failure + */ + public boolean playerAdd(String world, OfflinePlayer player, String permission) { + if (world == null) { + return playerAdd((String) null, player.getName(), permission); + } + return playerAdd(world, player.getName(), permission); + } + + /** + * Add permission to a player ONLY for the world the player is currently on. + * This is a world-specific operation, if you want to add global permission you must explicitly use NULL for the world. + * See {@link #playerAdd(String, OfflinePlayer, String)} for global permission use. + * + * @param player Player Object + * @param permission Permission node + * @return Success or Failure + */ + public boolean playerAdd(Player player, String permission) { + return playerAdd(player.getWorld().getName(), player, permission); + } + + /** + * Add transient permission to a player. + * This implementation can be used by any subclass which implements a "pure" superperms plugin, i.e. + * one that only needs the built-in Bukkit API to add transient permissions to a player. + * + * @param player to add to + * @param permission Permission node + * @return Success or Failure + */ + public boolean playerAddTransient(OfflinePlayer player, String permission) throws UnsupportedOperationException { + if (player.isOnline()) { + return playerAddTransient((Player) player, permission); + } + throw new UnsupportedOperationException(getName() + " does not support offline player transient permissions!"); + } + + /** + * Add transient permission to a player. + * This operation adds a permission onto the player object in bukkit via Bukkit's permission interface. + * + * @param player Player Object + * @param permission Permission node + * @return Success or Failure + */ + public boolean playerAddTransient(Player player, String permission) { + for (PermissionAttachmentInfo paInfo : player.getEffectivePermissions()) { + if (paInfo.getAttachment() != null && paInfo.getAttachment().getPlugin().equals(plugin)) { + paInfo.getAttachment().setPermission(permission, true); + return true; + } + } + + PermissionAttachment attach = player.addAttachment(plugin); + attach.setPermission(permission, true); + + return true; + } + + /** + * Adds a world specific transient permission to the player, may only work with some permission managers. + * Defaults to GLOBAL permissions for any permission system that does not support world-specific transient permissions! + * + * @param worldName to check on + * @param player to add to + * @param permission to test + * @return Success or Failure + */ + public boolean playerAddTransient(String worldName, OfflinePlayer player, String permission) { + return playerAddTransient(player, permission); + } + + /** + * Adds a world specific transient permission to the player, may only work with some permission managers. + * Defaults to GLOBAL permissions for any permission system that does not support world-specific transient permissions! + * + * @param worldName to check on + * @param player to check + * @param permission to check for + * @return Success or Failure + */ + public boolean playerAddTransient(String worldName, Player player, String permission) { + return playerAddTransient(player, permission); + } + + /** + * Removes a world specific transient permission from the player, may only work with some permission managers. + * Defaults to GLOBAL permissions for any permission system that does not support world-specific transient permissions! + * + * @param worldName to remove for + * @param player to remove for + * @param permission to remove + * @return Success or Failure + */ + public boolean playerRemoveTransient(String worldName, OfflinePlayer player, String permission) { + return playerRemoveTransient(player, permission); + } + + /** + * Removes a world specific transient permission from the player, may only work with some permission managers. + * Defaults to GLOBAL permissions for any permission system that does not support world-specific transient permissions! + * + * @param worldName to check on + * @param player to check + * @param permission to check for + * @return Success or Failure + */ + public boolean playerRemoveTransient(String worldName, Player player, String permission) { + return playerRemoveTransient((OfflinePlayer) player, permission); + } + + /** + * @deprecated As of VaultAPI 1.4 use {@link #playerRemove(String, OfflinePlayer, String)} instead. + */ + @Deprecated + abstract public boolean playerRemove(String world, String player, String permission); + + /** + * Remove permission from a player. + * Supports NULL value for World if the permission system registered supports global permissions. + * But May return odd values if the servers registered permission system does not have a global permission store. + * + * @param world World name + * @param player OfflinePlayer + * @param permission Permission node + * @return Success or Failure + */ + public boolean playerRemove(String world, OfflinePlayer player, String permission) { + if (world == null) { + return playerRemove((String) null, player.getName(), permission); + } + return playerRemove(world, player.getName(), permission); + } + + /** + * Remove permission from a player. + * Supports NULL value for World if the permission system registered supports global permissions. + * But May return odd values if the servers registered permission system does not have a global permission store. + * + * @param world World name + * @param player Player name + * @param permission Permission node + * @return Success or Failure + */ + @Deprecated + public boolean playerRemove(World world, String player, String permission) { + if (world == null) { + return playerRemove((String) null, player, permission); + } + return playerRemove(world.getName(), player, permission); + } + + /** + * Remove permission from a player. + * Will attempt to remove permission from the player on the player's current world. This is NOT a global operation. + * + * @param player Player Object + * @param permission Permission node + * @return Success or Failure + */ + public boolean playerRemove(Player player, String permission) { + return playerRemove(player.getWorld().getName(), player, permission); + } + + + /** + * Remove transient permission from a player. + * This implementation can be used by any subclass which implements a "pure" superperms plugin, i.e. + * one that only needs the built-in Bukkit API to remove transient permissions from a player. Any subclass + * implementing a plugin which provides its own API for this needs to override this method. + * + * @param player OfflinePlayer + * @param permission Permission node + * @return Success or Failure + */ + public boolean playerRemoveTransient(OfflinePlayer player, String permission) { + if (player.isOnline()) { + return playerRemoveTransient((Player) player, permission); + } else { + return false; + } + } + + /** + * Remove transient permission from a player. + * + * @param player Player Object + * @param permission Permission node + * @return Success or Failure + */ + public boolean playerRemoveTransient(Player player, String permission) { + for (PermissionAttachmentInfo paInfo : player.getEffectivePermissions()) { + if (paInfo.getAttachment() != null && paInfo.getAttachment().getPlugin().equals(plugin)) { + paInfo.getAttachment().unsetPermission(permission); + return true; + } + } + return false; + } + + /** + * Checks if group has a permission node. + * Supports NULL value for World if the permission system registered supports global permissions. + * But May return odd values if the servers registered permission system does not have a global permission store. + * + * @param world World name + * @param group Group name + * @param permission Permission node + * @return Success or Failure + */ + abstract public boolean groupHas(String world, String group, String permission); + + /** + * Checks if group has a permission node. + * Supports NULL value for World if the permission system registered supports global permissions. + * But May return odd values if the servers registered permission system does not have a global permission store. + * + * @param world World Object + * @param group Group name + * @param permission Permission node + * @return Success or Failure + */ + public boolean groupHas(World world, String group, String permission) { + if (world == null) { + return groupHas((String) null, group, permission); + } + return groupHas(world.getName(), group, permission); + } + + /** + * Add permission to a group. + * Supports NULL value for World if the permission system registered supports global permissions. + * But May return odd values if the servers registered permission system does not have a global permission store. + * + * @param world World name + * @param group Group name + * @param permission Permission node + * @return Success or Failure + */ + abstract public boolean groupAdd(String world, String group, String permission); + + /** + * Add permission to a group. + * Supports NULL value for World if the permission system registered supports global permissions. + * But May return odd values if the servers registered permission system does not have a global permission store. + * + * @param world World Object + * @param group Group name + * @param permission Permission node + * @return Success or Failure + */ + public boolean groupAdd(World world, String group, String permission) { + if (world == null) { + return groupAdd((String) null, group, permission); + } + return groupAdd(world.getName(), group, permission); + } + + /** + * Remove permission from a group. + * Supports NULL value for World if the permission system registered supports global permissions. + * But May return odd values if the servers registered permission system does not have a global permission store. + * + * @param world World name + * @param group Group name + * @param permission Permission node + * @return Success or Failure + */ + abstract public boolean groupRemove(String world, String group, String permission); + + /** + * Remove permission from a group. + * Supports NULL value for World if the permission system registered supports global permissions. + * But May return odd values if the servers registered permission system does not have a global permission store. + * + * @param world World Object + * @param group Group name + * @param permission Permission node + * @return Success or Failure + */ + public boolean groupRemove(World world, String group, String permission) { + if (world == null) { + return groupRemove((String) null, group, permission); + } + return groupRemove(world.getName(), group, permission); + } + + /** + * @deprecated As of VaultAPI 1.4 use {@link #playerInGroup(String, OfflinePlayer, String)} instead. + */ + @Deprecated + abstract public boolean playerInGroup(String world, String player, String group); + + /** + * @deprecated As of VaultAPI 1.4 use {@link #playerInGroup(String, OfflinePlayer, String)} instead. + */ + @Deprecated + public boolean playerInGroup(World world, String player, String group) { + if (world == null) { + return playerInGroup((String) null, player, group); + } + return playerInGroup(world.getName(), player, group); + } + + /** + * Check if player is member of a group. + * Supports NULL value for World if the permission system registered supports global permissions. + * But May return odd values if the servers registered permission system does not have a global permission store. + * + * @param world World Object + * @param player to check + * @param group Group name + * @return Success or Failure + */ + public boolean playerInGroup(String world, OfflinePlayer player, String group) { + if (world == null) { + return playerInGroup((String) null, player.getName(), group); + } + return playerInGroup(world, player.getName(), group); + } + + /** + * Check if player is member of a group. + * This method will ONLY check groups for which the player is in that are defined for the current world. + * This may result in odd return behaviour depending on what permission system has been registered. + * + * @param player Player Object + * @param group Group name + * @return Success or Failure + */ + public boolean playerInGroup(Player player, String group) { + return playerInGroup(player.getWorld().getName(), player, group); + } + + /** + * @deprecated As of VaultAPI 1.4 use {@link #playerAddGroup(String, OfflinePlayer, String)} instead. + */ + @Deprecated + abstract public boolean playerAddGroup(String world, String player, String group); + + /** + * @deprecated As of VaultAPI 1.4 use {@link #playerAddGroup(String, OfflinePlayer, String)} instead. + */ + @Deprecated + public boolean playerAddGroup(World world, String player, String group) { + if (world == null) { + return playerAddGroup((String) null, player, group); + } + return playerAddGroup(world.getName(), player, group); + } + + /** + * Add player to a group. + * Supports NULL value for World if the permission system registered supports global permissions. + * But May return odd values if the servers registered permission system does not have a global permission store. + * + * @param world String world name + * @param player to add + * @param group Group name + * @return Success or Failure + */ + public boolean playerAddGroup(String world, OfflinePlayer player, String group) { + if (world == null) { + return playerAddGroup((String) null, player.getName(), group); + } + return playerAddGroup(world, player.getName(), group); + } + + /** + * Add player to a group. + * This will add a player to the group on the current World. This may return odd results if the permission system + * being used on the server does not support world-specific groups, or if the group being added to is a global group. + * + * @param player Player Object + * @param group Group name + * @return Success or Failure + */ + public boolean playerAddGroup(Player player, String group) { + return playerAddGroup(player.getWorld().getName(), player, group); + } + + /** + * @deprecated As of VaultAPI 1.4 use {@link #playerRemoveGroup(String, OfflinePlayer, String)} instead. + */ + @Deprecated + abstract public boolean playerRemoveGroup(String world, String player, String group); + + /** + * @deprecated As of VaultAPI 1.4 use {@link #playerRemoveGroup(String, OfflinePlayer, String)} instead. + */ + @Deprecated + public boolean playerRemoveGroup(World world, String player, String group) { + if (world == null) { + return playerRemoveGroup((String) null, player, group); + } + return playerRemoveGroup(world.getName(), player, group); + } + + /** + * Remove player from a group. + * Supports NULL value for World if the permission system registered supports global permissions. + * But May return odd values if the servers registered permission system does not have a global permission store. + * + * @param world World Object + * @param player to remove + * @param group Group name + * @return Success or Failure + */ + public boolean playerRemoveGroup(String world, OfflinePlayer player, String group) { + if (world == null) { + return playerRemoveGroup((String) null, player.getName(), group); + } + return playerRemoveGroup(world, player.getName(), group); + } + + /** + * Remove player from a group. + * This will add a player to the group on the current World. This may return odd results if the permission system + * being used on the server does not support world-specific groups, or if the group being added to is a global group. + * + * @param player Player Object + * @param group Group name + * @return Success or Failure + */ + public boolean playerRemoveGroup(Player player, String group) { + return playerRemoveGroup(player.getWorld().getName(), player, group); + } + + /** + * @deprecated As of VaultAPI 1.4 use {@link #getPlayerGroups(String, OfflinePlayer)} instead. + */ + @Deprecated + abstract public String[] getPlayerGroups(String world, String player); + + /** + * @deprecated As of VaultAPI 1.4 use {@link #getPlayerGroups(String, OfflinePlayer)} instead. + */ + @Deprecated + public String[] getPlayerGroups(World world, String player) { + if (world == null) { + return getPlayerGroups((String) null, player); + } + return getPlayerGroups(world.getName(), player); + } + + /** + * Gets the list of groups that this player has + * Supports NULL value for World if the permission system registered supports global permissions. + * But May return odd values if the servers registered permission system does not have a global permission store. + * + * @param world String world name + * @param player OfflinePlayer + * @return Array of groups + */ + public String[] getPlayerGroups(String world, OfflinePlayer player) { + return getPlayerGroups(world, player.getName()); + } + + /** + * Returns a list of world-specific groups that this player is currently in. May return unexpected results if + * you are looking for global groups, or if the registered permission system does not support world-specific groups. + * See {@link #getPlayerGroups(String, OfflinePlayer)} for better control of World-specific or global groups. + * + * @param player Player Object + * @return Array of groups + */ + public String[] getPlayerGroups(Player player) { + return getPlayerGroups(player.getWorld().getName(), player); + } + + /** + * @deprecated As of VaultAPI 1.4 use {@link #getPrimaryGroup(String, OfflinePlayer)} instead. + */ + @Deprecated + abstract public String getPrimaryGroup(String world, String player); + + /** + * @deprecated As of VaultAPI 1.4 use {@link #getPrimaryGroup(String, OfflinePlayer)} instead. + */ + @Deprecated + public String getPrimaryGroup(World world, String player) { + if (world == null) { + return getPrimaryGroup((String) null, player); + } + return getPrimaryGroup(world.getName(), player); + } + + /** + * Gets players primary group + * Supports NULL value for World if the permission system registered supports global permissions. + * But May return odd values if the servers registered permission system does not have a global permission store. + * + * @param world String world name + * @param player to get from + * @return Players primary group + */ + public String getPrimaryGroup(String world, OfflinePlayer player) { + return getPrimaryGroup(world, player.getName()); + } + + /** + * Get players primary group. + * Defaults to the players current world, so may return only world-specific groups. + * In most cases {@link #getPrimaryGroup(String, OfflinePlayer)} is preferable. + * + * @param player Player Object + * @return Players primary group + */ + public String getPrimaryGroup(Player player) { + return getPrimaryGroup(player.getWorld().getName(), player); + } + + /** + * Returns a list of all known groups + * @return an Array of String of all groups + */ + abstract public String[] getGroups(); + + /** + * Returns true if the given implementation supports groups. + * @return true if the implementation supports groups + */ + abstract public boolean hasGroupSupport(); +} \ No newline at end of file From 1a733089329ca5c973a68e11e66257b1ecf27f45 Mon Sep 17 00:00:00 2001 From: Llm Dl Date: Mon, 27 Jun 2022 19:50:24 -0500 Subject: [PATCH 07/95] Economy v2. New methods include: - UUID-focused methods replacing the Name and OfflinePlayer methods. - getUUIDNameMap() which makes the economy plugin able to supply a Map of UUIDs and last-known-names on request. This will be used to replace the code in Vault which converts between economy plugins (and is currently only able to convert accounts belonging to players which have logged in.) The @Nullable annotation is used here in order to declare that the last-known-name of the account is allowed to be null. - getAccountName(UUID) which will return the last-known-name of an account or null. Other Changes: - Minor changes to javadocs. --- .../net/milkbowl/vault2/economy/Economy.java | 322 ++++++++++++++++++ 1 file changed, 322 insertions(+) create mode 100644 src/main/java/net/milkbowl/vault2/economy/Economy.java diff --git a/src/main/java/net/milkbowl/vault2/economy/Economy.java b/src/main/java/net/milkbowl/vault2/economy/Economy.java new file mode 100644 index 0000000..7f80531 --- /dev/null +++ b/src/main/java/net/milkbowl/vault2/economy/Economy.java @@ -0,0 +1,322 @@ +/* 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 . + */ + +package net.milkbowl.vault2.economy; + +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import org.jetbrains.annotations.Nullable; + +/** + * The main economy API + * + */ +public interface Economy { + + /* + * Economy plugin-related methods follow. + */ + + /** + * Checks if economy plugin is enabled. + * + * @return Success or Failure + */ + public boolean isEnabled(); + + /** + * Gets name of economy plugin. + * + * @return Name of Economy plugin. + */ + 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. + * + * @return number of digits after the decimal point kept + */ + public int fractionalDigits(); + + /** + * Format amount into a human readable String This provides translation into + * economy specific formatting to improve consistency between plugins. + * + * @param amount to format + * @return Human readable string describing amount + */ + 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. + * + * @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. + * + * @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 + * @return if the account creation was successful + */ + public boolean createAccount(UUID uuid); + + /** + * 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); + + /** + * Returns a map that represents all of the UUIDs which have accounts in the + * plugin, as well as their last-known-name whether it is null or not. 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 (null or not.) + */ + public Map 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. + * @return name of the account owner or null. + */ + @Nullable + 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); + + /** + * 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 UUID has amount, 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 UUID has amount in the given world, + * 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 getBanks(); +} From 918bda26d2fa1b7a51d33ffa62afed762119a033 Mon Sep 17 00:00:00 2001 From: Llm Dl Date: Mon, 27 Jun 2022 19:50:50 -0500 Subject: [PATCH 08/95] Update README to include new version, example code. --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index c186065..e2e71e5 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ How to include the API with Maven: com.github.MilkBowl VaultAPI - 1.7 + 2.0 provided @@ -24,7 +24,7 @@ repositories { maven { url 'https://jitpack.io' } } dependencies { - compileOnly "com.github.MilkBowl:VaultAPI:1.7" + compileOnly "com.github.MilkBowl:VaultAPI:2.0" } ``` @@ -69,10 +69,10 @@ package com.example.plugin; import java.util.logging.Logger; -import net.milkbowl.vault.chat.Chat; -import net.milkbowl.vault.economy.Economy; -import net.milkbowl.vault.economy.EconomyResponse; -import net.milkbowl.vault.permission.Permission; +import net.milkbowl.vault2.chat.Chat; +import net.milkbowl.vault2.economy.Economy; +import net.milkbowl.vault2.economy.EconomyResponse; +import net.milkbowl.vault2.permission.Permission; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; @@ -137,8 +137,8 @@ public class ExamplePlugin extends JavaPlugin { if(command.getLabel().equals("test-economy")) { // Lets give the player 1.05 currency (note that SOME economic plugins require rounding!) - sender.sendMessage(String.format("You have %s", econ.format(econ.getBalance(player.getName())))); - EconomyResponse r = econ.depositPlayer(player, 1.05); + sender.sendMessage(String.format("You have %s", econ.format(econ.getBalance(player.getUniqueId())))); + EconomyResponse r = econ.depositPlayer(player.getUniqueId(), 1.05); if(r.transactionSuccess()) { sender.sendMessage(String.format("You were given %s and now have %s", econ.format(r.amount), econ.format(r.balance))); } else { From 7129ffb94f876e6983c8c3d96cdce162bcd06b81 Mon Sep 17 00:00:00 2001 From: Llm Dl Date: Mon, 27 Jun 2022 21:36:24 -0500 Subject: [PATCH 09/95] Add account name to the createAccount method. --- src/main/java/net/milkbowl/vault2/economy/Economy.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/milkbowl/vault2/economy/Economy.java b/src/main/java/net/milkbowl/vault2/economy/Economy.java index 7f80531..a79ba93 100644 --- a/src/main/java/net/milkbowl/vault2/economy/Economy.java +++ b/src/main/java/net/milkbowl/vault2/economy/Economy.java @@ -99,9 +99,10 @@ public interface Economy { * 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); + public boolean createAccount(UUID uuid, String name); /** * Attempts to create an account for the given UUID on the specified world @@ -109,10 +110,11 @@ public interface Economy { * 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 worldName); + public boolean createAccount(UUID uuid, String name, String worldName); /** * Returns a map that represents all of the UUIDs which have accounts in the From 698c623ccc59299fdc5cde995392edda604e921e Mon Sep 17 00:00:00 2001 From: LlmDl Date: Wed, 3 Aug 2022 15:35:52 -0500 Subject: [PATCH 10/95] Fix typo in JavaDoc Co-authored-by: Morgan --- src/main/java/net/milkbowl/vault/chat/Chat.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/milkbowl/vault/chat/Chat.java b/src/main/java/net/milkbowl/vault/chat/Chat.java index 1554bb8..8945223 100644 --- a/src/main/java/net/milkbowl/vault/chat/Chat.java +++ b/src/main/java/net/milkbowl/vault/chat/Chat.java @@ -24,7 +24,8 @@ /** * The main Chat API - allows for Prefix/Suffix nodes along with generic Info nodes if the linked Chat system supports them * - * @deprecated in lieu of the modern Vault2. To update alter your import to new.milkbowl.vault2.chat. + * @deprecated in lieu of the modern Vault2. To update alter your import to net.milkbowl.vault2.chat. + */ public abstract class Chat { From 1af24b2e89b7a3dbfbcacfdbb0679713c1f2ed7c Mon Sep 17 00:00:00 2001 From: LlmDl Date: Wed, 3 Aug 2022 15:38:47 -0500 Subject: [PATCH 11/95] Fix typo in JavaDoc Co-authored-by: Morgan --- src/main/java/net/milkbowl/vault/economy/EconomyResponse.java | 2 +- src/main/java/net/milkbowl/vault/permission/Permission.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/milkbowl/vault/economy/EconomyResponse.java b/src/main/java/net/milkbowl/vault/economy/EconomyResponse.java index 2b6519e..b7f05e7 100644 --- a/src/main/java/net/milkbowl/vault/economy/EconomyResponse.java +++ b/src/main/java/net/milkbowl/vault/economy/EconomyResponse.java @@ -20,7 +20,7 @@ * It includes a {@link ResponseType} indicating whether the plugin currently being used for Economy actually allows * the method, or if the operation was a success or failure. * - * @deprecated in lieu of the modern Vault2. To update alter your import to new.milkbowl.vault2.economy. + * @deprecated in lieu of the modern Vault2. To update alter your import to net.milkbowl.vault2.economy. */ public class EconomyResponse { diff --git a/src/main/java/net/milkbowl/vault/permission/Permission.java b/src/main/java/net/milkbowl/vault/permission/Permission.java index 9d15318..608bc6c 100644 --- a/src/main/java/net/milkbowl/vault/permission/Permission.java +++ b/src/main/java/net/milkbowl/vault/permission/Permission.java @@ -28,7 +28,7 @@ /** * The main Permission API - allows for group and player based permission tests * - * @deprecated in lieu of the modern Vault2. To update alter your import to new.milkbowl.vault2.permission. + * @deprecated in lieu of the modern Vault2. To update alter your import to net.milkbowl.vault2.permission. */ public abstract class Permission { From 7c7d0abcc2a89011a5bd44f67088d6446c7cd676 Mon Sep 17 00:00:00 2001 From: Llm Dl Date: Wed, 3 Aug 2022 16:03:48 -0500 Subject: [PATCH 12/95] Implement requested changes. - Added renameAccount(UUID, String). - Remove @Nullable annotation and remove repo/dependency from pom.xml. - Fixed typo in javadoc in Economy. --- pom.xml | 11 -------- .../net/milkbowl/vault/economy/Economy.java | 2 +- .../net/milkbowl/vault2/economy/Economy.java | 27 ++++++++++++------- 3 files changed, 18 insertions(+), 22 deletions(-) diff --git a/pom.xml b/pom.xml index 1739da8..4a0800c 100644 --- a/pom.xml +++ b/pom.xml @@ -44,10 +44,6 @@ Vault currently supports the following: Permissions 3, PEX, GroupManager, bPerms spigot-repo https://hub.spigotmc.org/nexus/content/groups/public/ - - central - https://repo1.maven.org/maven2 - @@ -65,13 +61,6 @@ Vault currently supports the following: Permissions 3, PEX, GroupManager, bPerms ${bukkitVersion} provided - - - org.jetbrains - annotations - 23.0.0 - provided - junit diff --git a/src/main/java/net/milkbowl/vault/economy/Economy.java b/src/main/java/net/milkbowl/vault/economy/Economy.java index ceb1668..d37c725 100644 --- a/src/main/java/net/milkbowl/vault/economy/Economy.java +++ b/src/main/java/net/milkbowl/vault/economy/Economy.java @@ -23,7 +23,7 @@ /** * The main economy API * - * @deprecated in lieu of the modern Vault2. To update alter your import to new.milkbowl.vault2.economy and update to use the new UUID-based methods where available. + * @deprecated in lieu of the modern Vault2. To update alter your import to net.milkbowl.vault2.economy and update to use the new UUID-based methods where available. */ public interface Economy { diff --git a/src/main/java/net/milkbowl/vault2/economy/Economy.java b/src/main/java/net/milkbowl/vault2/economy/Economy.java index a79ba93..c60f576 100644 --- a/src/main/java/net/milkbowl/vault2/economy/Economy.java +++ b/src/main/java/net/milkbowl/vault2/economy/Economy.java @@ -20,8 +20,6 @@ import java.util.Map; import java.util.UUID; -import org.jetbrains.annotations.Nullable; - /** * The main economy API * @@ -29,7 +27,7 @@ public interface Economy { /* - * Economy plugin-related methods follow. + * Economy plugin-related methods follow. */ /** @@ -118,23 +116,21 @@ public interface Economy { /** * Returns a map that represents all of the UUIDs which have accounts in the - * plugin, as well as their last-known-name whether it is null or not. This is - * used for Vault's economy converter and should be given every account - * available. + * 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 (null or not.) + * with their associated last-known-name. */ - public Map getUUIDNameMap(); + public Map 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. - * @return name of the account owner or null. + * @return name of the account owner. */ - @Nullable public String getAccountName(UUID uuid); /** @@ -154,6 +150,17 @@ public interface Economy { */ public boolean hasAccount(UUID uuid, String worldName); + /** + * A method which changes the name associated with the given UUID in the + * Map 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 map. + * @return true if the name change is successful. + */ + public boolean renameAccount(UUID uuid, String name); + /** * Gets balance of a UUID * From d739d52432832ac310b888b243000abe8ec666ed Mon Sep 17 00:00:00 2001 From: LlmDl Date: Mon, 11 Dec 2023 09:58:21 -0600 Subject: [PATCH 13/95] Replace double usage with BigDecimal, to bring Vault2 further into the future. Major clean up of javadocs in the Economy class. --- .../net/milkbowl/vault2/economy/Economy.java | 276 +++++++++++------- .../vault2/economy/EconomyResponse.java | 15 +- 2 files changed, 176 insertions(+), 115 deletions(-) diff --git a/src/main/java/net/milkbowl/vault2/economy/Economy.java b/src/main/java/net/milkbowl/vault2/economy/Economy.java index c60f576..0212c5a 100644 --- a/src/main/java/net/milkbowl/vault2/economy/Economy.java +++ b/src/main/java/net/milkbowl/vault2/economy/Economy.java @@ -16,10 +16,13 @@ package net.milkbowl.vault2.economy; +import java.math.BigDecimal; import java.util.List; import java.util.Map; import java.util.UUID; +import net.milkbowl.vault2.economy.EconomyResponse.ResponseType; + /** * The main economy API * @@ -33,21 +36,21 @@ public interface Economy { /** * Checks if economy plugin is enabled. * - * @return Success or Failure + * @return true if the server's economy plugin has properly enabled. */ public boolean isEnabled(); /** - * Gets name of economy plugin. + * Gets name of the economy plugin. * - * @return Name of Economy plugin. + * @return Name of the active economy plugin on the server. */ public String getName(); /** - * Returns true if the given implementation supports banks. + * Returns true if the economy plugin supports banks. * - * @return true if the implementation supports banks + * @return true if the economy plugin supports banks. */ public boolean hasBankSupport(); @@ -60,24 +63,25 @@ public interface Economy { * function returns the number of digits the plugin keeps or -1 if no rounding * occurs. * - * @return number of digits after the decimal point kept + * @return number of digits after the decimal point this plugin supports or -1 + * if no rounding occurs. */ public int fractionalDigits(); /** - * Format amount into a human readable String This provides translation into - * economy specific formatting to improve consistency between plugins. + * Plugins use this method to format a given BigDecimal amount into a human + * readable amount using your economy plugin's currency names/conventions. * - * @param amount to format - * @return Human readable string describing amount + * @param amount to format. + * @return Human readable string describing amount, ie 5 Dollars or 5.55 Pounds. */ - public String format(double amount); + public String format(BigDecimal 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. * - * @return name of the currency (plural) + * @return name of the currency (plural) ie: Dollars or Pounds. */ public String currencyNamePlural(); @@ -85,7 +89,7 @@ public interface Economy { * 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) + * @return name of the currency (singular) ie: Dollar or Pound. */ public String currencyNameSingular(); @@ -94,11 +98,11 @@ public interface Economy { */ /** - * Attempts to create a account for the given uuid + * 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 + * @param uuid UUID associated with the account. + * @param name UUID associated with the account. + * @return true if the account creation was successful. */ public boolean createAccount(UUID uuid, String name); @@ -107,9 +111,9 @@ public interface Economy { * 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 + * @param uuid UUID associated with the account. + * @param name 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 name, String worldName); @@ -128,25 +132,25 @@ public interface Economy { * 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. + * @param uuid UUID associated with the account. * @return name of the account owner. */ public String getAccountName(UUID uuid); /** - * Checks if this uuid has an account yet + * Checks if this UUID has an account yet. * - * @param uuid to check - * @return if the uuid has an account + * @param uuid UUID to check for an existing account. + * @return true if the UUID has an account. */ public boolean hasAccount(UUID uuid); /** - * Checks if this uuid has an account yet on the given world + * 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 + * @param uuid UUID to check for an existing account. + * @param worldName world-specific account. + * @return if the UUID has an account. */ public boolean hasAccount(UUID uuid, String worldName); @@ -154,97 +158,109 @@ public interface Economy { * A method which changes the name associated with the given UUID in the * Map received from {@link #getUUIDNameMap()}. * - * @param uuid which is having a name change. - * @param name name that will be associated with the UUID in the + * @param uuid UUID whose account is having a name change. + * @param name String name that will be associated with the UUID in the * Map map. * @return true if the name change is successful. */ public boolean renameAccount(UUID uuid, String name); + /* + * Account balance related methods follow. + */ + /** - * Gets balance of a UUID + * Gets balance of an account associated with a UUID. * - * @param uuid of the account to get a balance for - * @return Amount currently held in account associated with the given UUID + * @param uuid 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); + public BigDecimal 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 + * @param uuid 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); + public BigDecimal getBalance(UUID uuid, String world); /** * Checks if the account associated with the given UUID has the amount - DO NOT - * USE NEGATIVE AMOUNTS + * USE NEGATIVE AMOUNTS. * - * @param uuid to check - * @param amount to check for - * @return True if UUID has amount, False else wise + * @param uuid the UUID associated with the account to check the balance of. + * @param amount the amount to check for. + * @return True if UUID has amount, False else wise. */ - public boolean has(UUID uuid, double amount); + public boolean has(UUID uuid, BigDecimal 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 + * @param uuid the UUID associated with the account to check the balance of. + * @param worldName the name of the world to check in. + * @param amount the amount to check for. * @return True if UUID has amount in the given world, - * False else wise + * False else wise. */ - public boolean has(UUID uuid, String worldName, double amount); + public boolean has(UUID uuid, String worldName, BigDecimal amount); /** * Withdraw an amount from an account associated with a UUID - DO NOT USE - * NEGATIVE AMOUNTS + * NEGATIVE AMOUNTS. * - * @param uuid to withdraw from - * @param amount Amount to withdraw - * @return Detailed response of transaction + * @param uuid the UUID associated with the account to withdraw from. + * @param amount Amount to withdraw. + * @return {@link EconomyResponse} which includes the Economy plugin's + * {@link ResponseType} as to whether the transaction was a Success, + * Failure, Unsupported. */ - public EconomyResponse withdraw(UUID uuid, double amount); + public EconomyResponse withdraw(UUID uuid, BigDecimal 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 + * @param uuid the UUID associated with the account to withdraw from. + * @param worldName the name of the world to check in. + * @param amount Amount to withdraw. + * @return {@link EconomyResponse} which includes the Economy plugin's + * {@link ResponseType} as to whether the transaction was a Success, + * Failure, Unsupported. */ - public EconomyResponse withdraw(UUID uuid, String worldName, double amount); + public EconomyResponse withdraw(UUID uuid, String worldName, BigDecimal amount); /** * Deposit an amount to an account associated with the given UUID - DO NOT USE - * NEGATIVE AMOUNTS + * NEGATIVE AMOUNTS. * - * @param uuid to deposit to - * @param amount Amount to deposit - * @return Detailed response of transaction + * @param uuid the UUID associated with the account to deposit to. + * @param amount Amount to deposit. + * @return {@link EconomyResponse} which includes the Economy plugin's + * {@link ResponseType} as to whether the transaction was a Success, + * Failure, Unsupported. */ - public EconomyResponse deposit(UUID uuid, double amount); + public EconomyResponse deposit(UUID uuid, BigDecimal amount); /** - * Deposit an amount from an account associated with a UUID on a given world - + * Deposit an amount to 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 + * @param uuid the UUID associated with the account to deposit to. + * @param worldName the name of the world to check in. + * @param amount Amount to deposit. + * @return {@link EconomyResponse} which includes the Economy plugin's + * {@link ResponseType} as to whether the transaction was a Success, + * Failure, Unsupported. */ - public EconomyResponse deposit(UUID uuid, String worldName, double amount); + public EconomyResponse deposit(UUID uuid, String worldName, BigDecimal amount); /* * Bank methods follow. @@ -252,80 +268,122 @@ public interface Economy { /** * Creates a bank account with the specified name and the given UUID as the - * owner + * owner. + * + * @param name Name of account. + * @param uuid UUID of the account should be linked to. + * @return true if bank creation is successful. + */ + public boolean createBank(String name, UUID uuid); + + /** + * Deletes a bank account with the specified UUID. + * + * @param uuid UUID of the bank to be deleted. + * @return true if the operation completed successfully + */ + public boolean deleteBank(UUID uuid); + + /** + * Returns a map that represents all of the UUIDs which have banks 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. * - * @param name of account - * @param uuid the account should be linked to - * @return EconomyResponse Object + * @return a {@link Map} composed of the accounts keyed by their UUID, along + * with their associated last-known-name. + */ + public Map getBankUUIDNameMap(); + + /** + * Gets the last known name of an bank with the given UUID. Required for + * messages to be more human-readable than UUIDs alone can provide. + * + * @param uuid UUID to look up. + * @return name of the bank. */ - public EconomyResponse createBank(String name, UUID uuid); + public String getBankAccountName(UUID uuid); /** - * Deletes a bank account with the specified name. + * Checks if this UUID has a bank yet. * - * @param name of the back to delete - * @return if the operation completed successfully + * @param uuid UUID to check. + * @return true if the UUID has an account. + */ + public boolean hasBankAccount(UUID uuid); + + /** + * A method which changes the name associated with the given UUID in the + * Map received from {@link #getBankUUIDNameMap()}. + * + * @param uuid UUID which is having a name change. + * @param name name that will be associated with the UUID in the + * Map map. + * @return true if the name change is successful. */ - public EconomyResponse deleteBank(String name); + public boolean renameBankAccount(UUID uuid, String name); /** - * Returns the amount the bank has + * Returns the amount the bank has. * - * @param name of the account - * @return EconomyResponse Object + * @param uuid UUID of the account. + * @return amount which the bank holds as a balance. */ - public EconomyResponse bankBalance(String name); + public BigDecimal bankBalance(UUID uuid); /** * Returns true or false whether the bank has the amount specified - DO NOT USE - * NEGATIVE AMOUNTS + * NEGATIVE AMOUNTS. * - * @param name of the account + * @param uuid UUID of the account. * @param amount to check for - * @return EconomyResponse Object + * @return true if the bank has the given amount. */ - public EconomyResponse bankHas(String name, double amount); + public boolean bankHas(UUID uuid, BigDecimal amount); /** - * Withdraw an amount from a bank account - DO NOT USE NEGATIVE AMOUNTS + * Withdraw an amount from a bank account - DO NOT USE NEGATIVE AMOUNTS. * - * @param name of the account - * @param amount to withdraw - * @return EconomyResponse Object + * @param uuid UUID of the account. + * @param amount to withdraw. + * @return {@link EconomyResponse} which includes the Economy plugin's + * {@link ResponseType} as to whether the transaction was a Success, + * Failure, Unsupported. */ - public EconomyResponse bankWithdraw(String name, double amount); + public EconomyResponse bankWithdraw(String name, BigDecimal amount); /** - * Deposit an amount into a bank account - DO NOT USE NEGATIVE AMOUNTS + * Deposit an amount into a bank account - DO NOT USE NEGATIVE AMOUNTS. * - * @param name of the account - * @param amount to deposit - * @return EconomyResponse Object + * @param uuid UUID of the account. + * @param amount to deposit. + * @return {@link EconomyResponse} which includes the Economy plugin's + * {@link ResponseType} as to whether the transaction was a Success, + * Failure, Unsupported. */ - public EconomyResponse bankDeposit(String name, double amount); + public EconomyResponse bankDeposit(String name, BigDecimal amount); /** - * Check if a uuid is the owner of a bank account + * 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 + * @param uuid UUID of the player/object who might be an owner. + * @param bankUUID UUID of the bank account to check ownership of. + * @return true if the uuid is the owner of the bank associated with bankUUID. */ - public EconomyResponse isBankOwner(String name, UUID uuid); + public boolean isBankOwner(UUID uuid, UUID bankUUID); /** - * Check if the uuid is a member of the bank account + * Check if the UUID is a member of the bank account * - * @param name of the account - * @param uuid to check membership - * @return EconomyResponse Object + * @param uuid UUID of the player/object who might be a member.. + * @param bankUUID UUID of the bank account to check membership of. + * @return @return true if the uuid is a member of the bank associated with bankUUID. */ - public EconomyResponse isBankMember(String name, UUID uuid); + public boolean isBankMember(UUID uuid, UUID bankUUID); /** - * Gets the list of banks + * Gets the list of banks' UUIDs. * - * @return the List of Banks + * @return the List of Banks' UUIDs. */ - public List getBanks(); + public List getBanks(); } diff --git a/src/main/java/net/milkbowl/vault2/economy/EconomyResponse.java b/src/main/java/net/milkbowl/vault2/economy/EconomyResponse.java index f920491..7e00634 100644 --- a/src/main/java/net/milkbowl/vault2/economy/EconomyResponse.java +++ b/src/main/java/net/milkbowl/vault2/economy/EconomyResponse.java @@ -15,10 +15,13 @@ */ package net.milkbowl.vault2.economy; +import java.math.BigDecimal; + /** - * Indicates a typical Return for an Economy method. - * It includes a {@link ResponseType} indicating whether the plugin currently being used for Economy actually allows - * the method, or if the operation was a success or failure. + * Indicates a typical Return for an Economy method. It includes a + * {@link ResponseType} indicating whether the plugin currently being used for + * Economy actually allows the method, or if the operation was a success or + * failure. * */ public class EconomyResponse { @@ -45,11 +48,11 @@ int getId() { /** * Amount modified by calling method */ - public final double amount; + public final BigDecimal amount; /** * New balance of account */ - public final double balance; + public final BigDecimal balance; /** * Success or failure of call. Using Enum of ResponseType to determine valid * outcomes @@ -67,7 +70,7 @@ int getId() { * @param type Success or failure type of the operation * @param errorMessage Error message if necessary (commonly null) */ - public EconomyResponse(double amount, double balance, ResponseType type, String errorMessage) { + public EconomyResponse(BigDecimal amount, BigDecimal balance, ResponseType type, String errorMessage) { this.amount = amount; this.balance = balance; this.type = type; From 79bb998347b6e6d63f39e8497013b9c9e9da670f Mon Sep 17 00:00:00 2001 From: LlmDl Date: Mon, 11 Dec 2023 10:05:08 -0600 Subject: [PATCH 14/95] Remove unneeded space in the readme, while we're already altering the readme. Closes #149. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4119f02..922b9c5 100644 --- a/README.md +++ b/README.md @@ -93,7 +93,7 @@ public class ExamplePlugin extends JavaPlugin { @Override public void onEnable() { - if (!setupEconomy() ) { + if (!setupEconomy()) { getLogger().severe(String.format("[%s] - Disabled due to no Vault dependency found!", getDescription().getName())); getServer().getPluginManager().disablePlugin(this); return; From b52495b66fd20e12d5b134ab5f6672200ce44b57 Mon Sep 17 00:00:00 2001 From: LlmDl Date: Mon, 11 Dec 2023 14:06:10 -0600 Subject: [PATCH 15/95] Alter readme to use BigDecimal in example. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 922b9c5..0294407 100644 --- a/README.md +++ b/README.md @@ -137,7 +137,7 @@ public class ExamplePlugin extends JavaPlugin { if(command.getLabel().equals("test-economy")) { // Lets give the player 1.05 currency (note that SOME economic plugins require rounding!) sender.sendMessage(String.format("You have %s", econ.format(econ.getBalance(player.getUniqueId())))); - EconomyResponse r = econ.depositPlayer(player.getUniqueId(), 1.05); + EconomyResponse r = econ.depositPlayer(player.getUniqueId(), new BigDecimal("1.05")); if(r.transactionSuccess()) { sender.sendMessage(String.format("You were given %s and now have %s", econ.format(r.amount), econ.format(r.balance))); } else { From c491a544b0f6be6f2842394227ac59473ebac332 Mon Sep 17 00:00:00 2001 From: Daniel V Date: Wed, 12 Jun 2024 10:40:57 -0400 Subject: [PATCH 16/95] Rebranded to VaultUnlocked because accepting PRs and adding actual improvements is such a radical idea. --- .github/workflows/maven.yml | 2 +- .github/workflows/release.yml | 2 +- .gitignore | 2 ++ .mvn/settings.xml | 36 ---------------------- .travis.yml | 13 -------- .utility/do-publish.sh | 24 --------------- .utility/settings.xml | 9 ------ README.md | 12 ++++---- pom.xml | 56 ++++++++++++++++++++++------------- 9 files changed, 46 insertions(+), 110 deletions(-) delete mode 100644 .mvn/settings.xml delete mode 100644 .travis.yml delete mode 100755 .utility/do-publish.sh delete mode 100644 .utility/settings.xml diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 31df88d..f5abe21 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -34,5 +34,5 @@ jobs: run: mkdir staging && cp target/*.jar staging - uses: actions/upload-artifact@v2 with: - name: VaultAPI + name: VaultUnlockedAPI path: staging diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 97b9189..8eabd27 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,4 +1,4 @@ -name: Publish VaultAPI to GitHub Packages +name: Publish VaultUnlockedAPI to GitHub Packages on: release: types: [created] diff --git a/.gitignore b/.gitignore index 37cc1ae..5450c1b 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,5 @@ /.project /.settings /bin/ +/.idea/ +/VaultAPI.iml diff --git a/.mvn/settings.xml b/.mvn/settings.xml deleted file mode 100644 index bdef178..0000000 --- a/.mvn/settings.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - github - - - - - github - - - central - https://repo1.maven.org/maven2 - true - true - - - github - GitHub Maven Packages - https://maven.pkg.github.com/milkbowl/github-releases - - - - - - - - github - MilkBowl - ${env.GITHUB_TOKEN} - - - \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 708d9c4..0000000 --- a/.travis.yml +++ /dev/null @@ -1,13 +0,0 @@ -language: java -jdk: [ openjdk8 ] -branches: - except: - - gh-pages -sudo: false -env: - global: - - secure: "lkC+9PeVPx0sFEAITPszoHvPV9jnavsJdA3Slo4FakzTB5AlERHszto4RdenAhPf347r8xKL120YvDxDeYvmffpG7NUcRXfQZxod1SRyFEFUUBC0zGHkLiJlBjAqkSEDacruldT4+1BCqRc/A96zj17knmUkvKnyutQtasOGKxk=" - - secure: "UxxyRTgZFxEbzxfpEKFC6bYVKkhVp/kOCy5QZwbctkwQP33l3eEwDUquDVXewwLWgM6yJvWdUq9Va/f2kJ8Z7NMHLj5UTj3zIWdqJ/dZIrZ32Vb6tTawXV56627ANLsGHfw55uqIIHFs3u3HUlucyYhBAxLsxJNR4XbU2IeA8fA=" - - secure: "ljUPRZkuNEqck8RIHONVD7lCr1a/aslagOQ27uB0EpuOMGfeBlDdAlpo+GnRSs2bsfvUGX9nmcgGPR6mTcV0fzHaSBg+p/BPWBuzo9wEs39H4wn8yVU70pu/wCEuRhGlFw4GE0mYp8pbHMHrc8WdxsF3dt4kAGsdVhivXuz9HHI=" -after_success: -- .utility/do-publish.sh diff --git a/.utility/do-publish.sh b/.utility/do-publish.sh deleted file mode 100755 index f663952..0000000 --- a/.utility/do-publish.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -current_dir=`pwd` - -if [[ "$TRAVIS_REPO_SLUG" != "MilkBowl/VaultAPI" || "$TRAVIS_PULL_REQUEST" == "true" || "$TRAVIS_BRANCH" != "master" ]] -then - echo 'Travis can only publish docs for release builds.' - return 0 -fi - -mvn clean javadoc:javadoc javadoc:jar deploy --settings .utility/settings.xml - -# Get to the Travis build directory, configure git and clone the repo -cd $HOME -git config --global user.email "travis@travis-ci.org" -git config --global user.name "travis-ci" -git clone --quiet --branch=gh-pages https://${GH_TOKEN}@github.com/MilkBowl/VaultAPI gh-pages > /dev/null - -# Commit and Push the Changes -cd gh-pages -git rm -rf * -cp -Rfv $current_dir/target/javadoc-latest/* ./ -git add -f . -git commit -m "Latest javadoc on successful travis build $TRAVIS_BUILD_NUMBER auto-pushed to gh-pages" -git push -fq origin gh-pages > /dev/null diff --git a/.utility/settings.xml b/.utility/settings.xml deleted file mode 100644 index e16eb13..0000000 --- a/.utility/settings.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - pub-repo - ${env.DEPLOY_USER} - ${env.DEPLOY_PASS} - - - \ No newline at end of file diff --git a/README.md b/README.md index d50c704..871f7aa 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# VaultAPI - Abstraction Library API for Bukkit Plugins - [![](https://travis-ci.org/MilkBowl/VaultAPI.svg?branch=master)](https://travis-ci.org/MilkBowl/VaultAPI) +# VaultUnlockedAPI - Abstraction Library API for Bukkit Plugins - [![](https://travis-ci.org/MilkBowl/VaultAPI.svg?branch=master)](https://travis-ci.org/MilkBowl/VaultAPI) How to include the API with Maven: ```xml @@ -28,9 +28,11 @@ dependencies { } ``` -**Note**: The VaultAPI version has 2 numbers (major.minor), unlike Vault, which has 3. The 2 numbers in the VaultAPI will always correspond to the 2 beginning numbers in a Vault version to make it clear what versions your plugin will for sure work with. +**Note**: The VaultUnlockedAPI version has 2 numbers (major.minor), unlike Vault, which has 3. The 2 +numbers in the VaultUnlockedAPI will always correspond to the 2 beginning numbers in a VaultUnlocked +version to make it clear what versions your plugin will for sure work with. -## Why Vault? +## Why VaultUnlocked? I have no preference which library suits your plugin and development efforts best. Really, I thought a central suite (rather...Vault) of solutions was the the proper avenue than focusing on a single category of plugin. That's where @@ -59,10 +61,10 @@ You should have received a copy of the GNU Lesser General Public License along with Vault. If not, see . ## Building -VaultAPI comes with all libraries needed to build from the current branch. +VaultUnlockedAPI comes with all libraries needed to build from the current branch. ## Implementing Vault -Implementing Vault is quite simple. It requires getting the Economy, Permission, or Chat service from the Bukkit ServiceManager. See the example below: +Implementing VaultUnlocked is quite simple. It requires getting the Economy, Permission, or Chat service from the Bukkit ServiceManager. See the example below: ```java package com.example.plugin; diff --git a/pom.xml b/pom.xml index 959b534..078dd64 100644 --- a/pom.xml +++ b/pom.xml @@ -2,13 +2,13 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 net.milkbowl.vault - VaultAPI - 1.7 + VaultUnlockedAPI + 2.0 - 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. + VaultUnlockedAPI + VaultUnlocked is a Permissions & Economy API to allow plugins to more easily hook into these systems without needing to hook each individual system themselves. -Vault currently supports the following: Permissions 3, PEX, GroupManager, bPerms, bPerms2, SimplyPerms, DroxPerms, zPermissions, rscPermissions, KPerms, Starburst, iConomy (4/5/6) BOSEconomy *6/7), EssentialsEcon, 3Co, MultiConomy, MineConomy, EconXP, eWallet, CurrencyCore, XPBank, CraftConomy, AEco, SDFEconomy, TAEcon + VaultUnlocked supports all plugins that support Vault http://dev.bukkit.org/server-mods/vault/ @@ -18,25 +18,36 @@ Vault currently supports the following: Permissions 3, PEX, GroupManager, bPerms + - MilkBowl - https://github.com/MilkBowl + The New Economy + https://tnemc.net + + + creatorfromhell + Daniel "creatorfromhell" Vidmar + daniel.viddy@gmail.com + https://cfh.dev + The New Economy + https://tnemc.net + + developer + + America/New_York + + + - https://github.com/MilkBowl/VaultAPI - scm:git:git://github.com:MilkBowl/VaultAPI.git + https://github.com/TheNewEconomy/VaultUnlockedAPI + scm:git:git://github.com/TheNewEconomy/VaultUnlockedAPI.git scm:git:git@github.com:MilkBowl/VaultAPI.git - - Travis-CI - https://travis-ci.org/MilkBowl/VaultAPI - - GitHub - https://github.com/MilkBowl/VaultAPI/issues + https://github.com/TheNewEconomy/VaultUnlockedAPI/issues @@ -47,11 +58,14 @@ Vault currently supports the following: Permissions 3, PEX, GroupManager, bPerms - - github - GitHub Packages - https://maven.pkg.github.com/milkbowl/github-releases - + + codemc-releases + https://repo.codemc.io/repository/maven-releases/ + + + codemc-snapshots + https://repo.codemc.io/repository/maven-snapshots/ + @@ -110,7 +124,7 @@ Vault currently supports the following: Permissions 3, PEX, GroupManager, bPerms true true true - Milkbowl, 2020]]> + TheNewEconomy, 2024]]> ${project.build.directory} javadoc-latest From 5776aaf43c99ae9d9d2de15d73405cff59069e97 Mon Sep 17 00:00:00 2001 From: Daniel V Date: Wed, 12 Jun 2024 11:27:11 -0400 Subject: [PATCH 17/95] Update Maven compiler plugin --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 078dd64..8ed7438 100644 --- a/pom.xml +++ b/pom.xml @@ -92,10 +92,10 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.1 + 3.10.1 - 1.8 - 1.8 + 8 + 8 From 7d94726d4eca4260f83c94d9340b68dfd840d651 Mon Sep 17 00:00:00 2001 From: Daniel V Date: Wed, 12 Jun 2024 11:39:00 -0400 Subject: [PATCH 18/95] Update README.md. --- README.md | 52 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 871f7aa..52a745d 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,18 @@ -# VaultUnlockedAPI - Abstraction Library API for Bukkit Plugins - [![](https://travis-ci.org/MilkBowl/VaultAPI.svg?branch=master)](https://travis-ci.org/MilkBowl/VaultAPI) +# VaultUnlockedAPI - Abstraction Library API for Bukkit Plugins - [![Build Status](https://ci.codemc.io/job/creatorfromhell/job/VaultUnlockedAPI/badge/icon)](https://ci.codemc.io/job/creatorfromhell/job/VaultUnlockedAPI/) How to include the API with Maven: ```xml - jitpack.io - https://jitpack.io + codemc-repo + https://repo.codemc.org/repository/maven-public - com.github.MilkBowl - VaultAPI - 1.7 - provided + net.milkbowl.vault + VaultUnlockedAPI + 2.0 ``` @@ -21,10 +20,10 @@ How to include the API with Maven: How to include the API with Gradle: ```groovy repositories { - maven { url 'https://jitpack.io' } + maven { url 'https://repo.codemc.org/repository/maven-public' } } dependencies { - compileOnly "com.github.MilkBowl:VaultAPI:1.7" + compileOnly "net.milkbowl.vault:VaultUnlockedAPI:2.0" } ``` @@ -33,26 +32,37 @@ numbers in the VaultUnlockedAPI will always correspond to the 2 beginning number version to make it clear what versions your plugin will for sure work with. ## Why VaultUnlocked? -I have no preference which library suits your plugin and development efforts -best. Really, I thought a central suite (rather...Vault) of solutions was the -the proper avenue than focusing on a single category of plugin. That's where -the idea for Vault came into play. +I have no preference regarding which library is best suited for +your plugin development efforts. I believe a central suite (or "Vault") +of solutions is a more effective approach than focusing on a single +category of plugins. This is the concept behind VaultUnlocked. -So, what features do I _think_ you'll like the most? +### Key Features You'll Appreciate - * No need to include my source code in your plugin - * Broad range of supported plugins - * Choice! +* **No Source Code Integration Needed** + VaultUnlocked operates as a standalone plugin, so you only need to obtain an instance of it. This prevents conflicts with multiple plugins using the same namespaces. Simply include VaultUnlocked.jar in your download zip file for seamless integration! +* **Extensive Plugin Support** + VaultUnlocked provides an abstraction layer not just for Economic plugins but for Permission plugins as well, ensuring broad compatibility. +* **Freedom of Choice** + One of the best aspects of Bukkit is the freedom to choose what to use. More options benefit developers, so here’s to embracing choice! + +### Enhanced Features of VaultUnlocked + +* **Multi-Currency Support** +* **More Friendly PR Acceptance** +* **Folia Support** + +Let me know if you need any further modifications! ## License -Copyright (C) 2011-2018 Morgan Humes +Copyright (C) 2024 Daniel "creatorfromhell" Vidmar -Vault is free software: you can redistribute it and/or modify +VaultUnlocked 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, +VaultUnlocked 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. @@ -63,7 +73,7 @@ along with Vault. If not, see . ## Building VaultUnlockedAPI comes with all libraries needed to build from the current branch. -## Implementing Vault +## Implementing VaultUnlocked Implementing VaultUnlocked is quite simple. It requires getting the Economy, Permission, or Chat service from the Bukkit ServiceManager. See the example below: ```java From 3fb336e5c94bae3c133f7da46f1bbc1ad2ef8b0e Mon Sep 17 00:00:00 2001 From: Daniel V Date: Wed, 12 Jun 2024 12:15:45 -0400 Subject: [PATCH 19/95] Remove abstracteconomy, it wasn't even that abstract --- .../vault/economy/AbstractEconomy.java | 87 ------------------- .../net/milkbowl/vault/economy/Economy.java | 86 +++++++++--------- 2 files changed, 43 insertions(+), 130 deletions(-) delete mode 100644 src/main/java/net/milkbowl/vault/economy/AbstractEconomy.java 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..b844c3e 100644 --- a/src/main/java/net/milkbowl/vault/economy/Economy.java +++ b/src/main/java/net/milkbowl/vault/economy/Economy.java @@ -30,19 +30,19 @@ public interface Economy { * Checks if economy method is enabled. * @return Success or Failure */ - public boolean isEnabled(); + boolean isEnabled(); /** * Gets name of economy method * @return Name of Economy Method */ - public String getName(); + String getName(); /** * Returns true if the given implementation supports banks. * @return true if the implementation supports banks */ - public boolean hasBankSupport(); + boolean hasBankSupport(); /** * Some economy plugins round off after a certain number of digits. @@ -50,7 +50,7 @@ public interface Economy { * or -1 if no rounding occurs. * @return number of digits after the decimal point kept */ - public int fractionalDigits(); + int fractionalDigits(); /** * Format amount into a human readable String This provides translation into @@ -59,7 +59,7 @@ public interface Economy { * @param amount to format * @return Human readable string describing amount */ - public String format(double amount); + String format(double amount); /** * Returns the name of the currency in plural form. @@ -67,7 +67,7 @@ public interface Economy { * * @return name of the currency (plural) */ - public String currencyNamePlural(); + String currencyNamePlural(); /** @@ -76,14 +76,14 @@ public interface Economy { * * @return name of the currency (singular) */ - public String currencyNameSingular(); + String currencyNameSingular(); /** * * @deprecated As of VaultAPI 1.4 use {@link #hasAccount(OfflinePlayer)} instead. */ @Deprecated - public boolean hasAccount(String playerName); + boolean hasAccount(String playerName); /** * Checks if this player has an account on the server yet @@ -93,13 +93,13 @@ public interface Economy { * @param player to check * @return if the player has an account */ - public boolean hasAccount(OfflinePlayer player); + boolean hasAccount(OfflinePlayer player); /** * @deprecated As of VaultAPI 1.4 use {@link #hasAccount(OfflinePlayer, String)} instead. */ @Deprecated - public boolean hasAccount(String playerName, String worldName); + boolean hasAccount(String playerName, String worldName); /** * Checks if this player has an account on the server yet on the given world @@ -110,13 +110,13 @@ public interface Economy { * @param worldName world-specific account * @return if the player has an account */ - public boolean hasAccount(OfflinePlayer player, String worldName); + boolean hasAccount(OfflinePlayer player, String worldName); /** * @deprecated As of VaultAPI 1.4 use {@link #getBalance(OfflinePlayer)} instead. */ @Deprecated - public double getBalance(String playerName); + double getBalance(String playerName); /** * Gets balance of a player @@ -124,13 +124,13 @@ public interface Economy { * @param player of the player * @return Amount currently held in players account */ - public double getBalance(OfflinePlayer player); + double getBalance(OfflinePlayer player); /** * @deprecated As of VaultAPI 1.4 use {@link #getBalance(OfflinePlayer, String)} instead. */ @Deprecated - public double getBalance(String playerName, String world); + double getBalance(String playerName, String world); /** * Gets balance of a player on the specified world. @@ -139,13 +139,13 @@ public interface Economy { * @param world name of the world * @return Amount currently held in players account */ - public double getBalance(OfflinePlayer player, String world); + 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); + boolean has(String playerName, double amount); /** * Checks if the player account has the amount - DO NOT USE NEGATIVE AMOUNTS @@ -154,13 +154,13 @@ public interface Economy { * @param amount to check for * @return True if player has amount, False else wise */ - public boolean has(OfflinePlayer player, double amount); + 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); + boolean has(String playerName, String worldName, double amount); /** * Checks if the player account has the amount in a given world - DO NOT USE NEGATIVE AMOUNTS @@ -171,13 +171,13 @@ public interface Economy { * @param amount to check for * @return True if player has amount, False else wise */ - public boolean has(OfflinePlayer player, String worldName, double amount); + 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); + EconomyResponse withdrawPlayer(String playerName, double amount); /** * Withdraw an amount from a player - DO NOT USE NEGATIVE AMOUNTS @@ -186,13 +186,13 @@ public interface Economy { * @param amount Amount to withdraw * @return Detailed response of transaction */ - public EconomyResponse withdrawPlayer(OfflinePlayer player, double amount); + EconomyResponse withdrawPlayer(OfflinePlayer player, double amount); /** * @deprecated As of VaultAPI 1.4 use {@link #withdrawPlayer(OfflinePlayer, String, double)} instead. */ @Deprecated - public EconomyResponse withdrawPlayer(String playerName, String worldName, double amount); + EconomyResponse withdrawPlayer(String playerName, String worldName, double amount); /** * Withdraw an amount from a player on a given world - DO NOT USE NEGATIVE AMOUNTS @@ -202,13 +202,13 @@ public interface Economy { * @param amount Amount to withdraw * @return Detailed response of transaction */ - public EconomyResponse withdrawPlayer(OfflinePlayer player, String worldName, double amount); + EconomyResponse withdrawPlayer(OfflinePlayer player, String worldName, double amount); /** * @deprecated As of VaultAPI 1.4 use {@link #depositPlayer(OfflinePlayer, double)} instead. */ @Deprecated - public EconomyResponse depositPlayer(String playerName, double amount); + EconomyResponse depositPlayer(String playerName, double amount); /** * Deposit an amount to a player - DO NOT USE NEGATIVE AMOUNTS @@ -217,13 +217,13 @@ public interface Economy { * @param amount Amount to deposit * @return Detailed response of transaction */ - public EconomyResponse depositPlayer(OfflinePlayer player, double amount); + EconomyResponse depositPlayer(OfflinePlayer player, double amount); /** * @deprecated As of VaultAPI 1.4 use {@link #depositPlayer(OfflinePlayer, String, double)} instead. */ @Deprecated - public EconomyResponse depositPlayer(String playerName, String worldName, double amount); + EconomyResponse depositPlayer(String playerName, String worldName, double amount); /** * Deposit an amount to a player - DO NOT USE NEGATIVE AMOUNTS @@ -234,13 +234,13 @@ public interface Economy { * @param amount Amount to deposit * @return Detailed response of transaction */ - public EconomyResponse depositPlayer(OfflinePlayer player, String worldName, double amount); + EconomyResponse depositPlayer(OfflinePlayer player, String worldName, double amount); /** * @deprecated As of VaultAPI 1.4 use {{@link #createBank(String, OfflinePlayer)} instead. */ @Deprecated - public EconomyResponse createBank(String name, String player); + EconomyResponse createBank(String name, String player); /** * Creates a bank account with the specified name and the player as the owner @@ -248,21 +248,21 @@ public interface Economy { * @param player the account should be linked to * @return EconomyResponse Object */ - public EconomyResponse createBank(String name, OfflinePlayer player); + 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 */ - public EconomyResponse deleteBank(String name); + EconomyResponse deleteBank(String name); /** * Returns the amount the bank has * @param name of the account * @return EconomyResponse Object */ - public EconomyResponse bankBalance(String name); + EconomyResponse bankBalance(String name); /** * Returns true or false whether the bank has the amount specified - DO NOT USE NEGATIVE AMOUNTS @@ -271,7 +271,7 @@ public interface Economy { * @param amount to check for * @return EconomyResponse Object */ - public EconomyResponse bankHas(String name, double amount); + EconomyResponse bankHas(String name, double amount); /** * Withdraw an amount from a bank account - DO NOT USE NEGATIVE AMOUNTS @@ -280,7 +280,7 @@ public interface Economy { * @param amount to withdraw * @return EconomyResponse Object */ - public EconomyResponse bankWithdraw(String name, double amount); + EconomyResponse bankWithdraw(String name, double amount); /** * Deposit an amount into a bank account - DO NOT USE NEGATIVE AMOUNTS @@ -289,13 +289,13 @@ public interface Economy { * @param amount to deposit * @return EconomyResponse Object */ - public EconomyResponse bankDeposit(String name, double amount); + EconomyResponse bankDeposit(String name, double amount); /** * @deprecated As of VaultAPI 1.4 use {{@link #isBankOwner(String, OfflinePlayer)} instead. */ @Deprecated - public EconomyResponse isBankOwner(String name, String playerName); + EconomyResponse isBankOwner(String name, String playerName); /** * Check if a player is the owner of a bank account @@ -304,13 +304,13 @@ public interface Economy { * @param player to check for ownership * @return EconomyResponse Object */ - public EconomyResponse isBankOwner(String name, OfflinePlayer player); + EconomyResponse isBankOwner(String name, OfflinePlayer player); /** * @deprecated As of VaultAPI 1.4 use {{@link #isBankMember(String, OfflinePlayer)} instead. */ @Deprecated - public EconomyResponse isBankMember(String name, String playerName); + EconomyResponse isBankMember(String name, String playerName); /** * Check if the player is a member of the bank account @@ -319,32 +319,32 @@ public interface Economy { * @param player to check membership * @return EconomyResponse Object */ - public EconomyResponse isBankMember(String name, OfflinePlayer player); + EconomyResponse isBankMember(String name, OfflinePlayer player); /** * Gets the list of banks * @return the List of Banks */ - public List getBanks(); + List getBanks(); /** * @deprecated As of VaultAPI 1.4 use {{@link #createPlayerAccount(OfflinePlayer)} instead. */ @Deprecated - public boolean createPlayerAccount(String playerName); + boolean createPlayerAccount(String playerName); /** * Attempts to create a player account for the given player * @param player OfflinePlayer * @return if the account creation was successful */ - public boolean createPlayerAccount(OfflinePlayer player); + boolean createPlayerAccount(OfflinePlayer player); /** * @deprecated As of VaultAPI 1.4 use {{@link #createPlayerAccount(OfflinePlayer, String)} instead. */ @Deprecated - public boolean createPlayerAccount(String playerName, String worldName); + boolean createPlayerAccount(String playerName, String worldName); /** * Attempts to create a player account for the given player on the specified world @@ -353,5 +353,5 @@ public interface Economy { * @param worldName String name of the world * @return if the account creation was successful */ - public boolean createPlayerAccount(OfflinePlayer player, String worldName); + boolean createPlayerAccount(OfflinePlayer player, String worldName); } From 6e69e209e177e685692a6589e80362b0a241e91e Mon Sep 17 00:00:00 2001 From: Daniel V Date: Wed, 12 Jun 2024 12:18:27 -0400 Subject: [PATCH 20/95] Update gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 5450c1b..9686bf3 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ /bin/ /.idea/ /VaultAPI.iml +/VaultUnlockedAPI.iml From ab14d7fd87b5c19729c1bf61a7fbd54cf3b972af Mon Sep 17 00:00:00 2001 From: Daniel V Date: Wed, 12 Jun 2024 12:21:28 -0400 Subject: [PATCH 21/95] Update gitignore --- .gitignore | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.gitignore b/.gitignore index 37cc1ae..1755f3a 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,12 @@ /.project /.settings /bin/ +VaultUnlockedAPI.iml +.idea/vcs.xml +.idea/workspace.xml +.idea/compiler.xml +.idea/discord.xml +.idea/jarRepositories.xml +.idea/misc.xml +.idea/modules.xml +.idea/encodings.xml From 6a88d39a7c0a994ac344bec46b26789818e582ea Mon Sep 17 00:00:00 2001 From: Daniel V Date: Wed, 12 Jun 2024 12:28:41 -0400 Subject: [PATCH 22/95] Cleanup code from vault2. --- .../net/milkbowl/vault2/economy/Economy.java | 70 +++++++++---------- .../vault2/economy/EconomyResponse.java | 2 +- 2 files changed, 36 insertions(+), 36 deletions(-) diff --git a/src/main/java/net/milkbowl/vault2/economy/Economy.java b/src/main/java/net/milkbowl/vault2/economy/Economy.java index 0212c5a..4e5bc00 100644 --- a/src/main/java/net/milkbowl/vault2/economy/Economy.java +++ b/src/main/java/net/milkbowl/vault2/economy/Economy.java @@ -38,21 +38,21 @@ public interface Economy { * * @return true if the server's economy plugin has properly enabled. */ - public boolean isEnabled(); + boolean isEnabled(); /** * Gets name of the economy plugin. * * @return Name of the active economy plugin on the server. */ - public String getName(); + String getName(); /** * Returns true if the economy plugin supports banks. * * @return true if the economy plugin supports banks. */ - public boolean hasBankSupport(); + boolean hasBankSupport(); /* * Currency-related methods follow. @@ -66,7 +66,7 @@ public interface Economy { * @return number of digits after the decimal point this plugin supports or -1 * if no rounding occurs. */ - public int fractionalDigits(); + int fractionalDigits(); /** * Plugins use this method to format a given BigDecimal amount into a human @@ -75,7 +75,7 @@ public interface Economy { * @param amount to format. * @return Human readable string describing amount, ie 5 Dollars or 5.55 Pounds. */ - public String format(BigDecimal amount); + String format(BigDecimal amount); /** * Returns the name of the currency in plural form. If the economy being used @@ -83,7 +83,7 @@ public interface Economy { * * @return name of the currency (plural) ie: Dollars or Pounds. */ - public String currencyNamePlural(); + String currencyNamePlural(); /** * Returns the name of the currency in singular form. If the economy being used @@ -91,7 +91,7 @@ public interface Economy { * * @return name of the currency (singular) ie: Dollar or Pound. */ - public String currencyNameSingular(); + String currencyNameSingular(); /* * Account-related methods follow. @@ -104,7 +104,7 @@ public interface Economy { * @param name UUID associated with the account. * @return true if the account creation was successful. */ - public boolean createAccount(UUID uuid, String name); + boolean createAccount(UUID uuid, String name); /** * Attempts to create an account for the given UUID on the specified world @@ -116,7 +116,7 @@ public interface Economy { * @param worldName String name of the world. * @return if the account creation was successful */ - public boolean createAccount(UUID uuid, String name, String worldName); + boolean createAccount(UUID uuid, String name, String worldName); /** * Returns a map that represents all of the UUIDs which have accounts in the @@ -126,7 +126,7 @@ public interface Economy { * @return a {@link Map} composed of the accounts keyed by their UUID, along * with their associated last-known-name. */ - public Map getUUIDNameMap(); + Map getUUIDNameMap(); /** * Gets the last known name of an account owned by the given UUID. Required for @@ -135,7 +135,7 @@ public interface Economy { * @param uuid UUID associated with the account. * @return name of the account owner. */ - public String getAccountName(UUID uuid); + String getAccountName(UUID uuid); /** * Checks if this UUID has an account yet. @@ -143,7 +143,7 @@ public interface Economy { * @param uuid UUID to check for an existing account. * @return true if the UUID has an account. */ - public boolean hasAccount(UUID uuid); + boolean hasAccount(UUID uuid); /** * Checks if this UUID has an account yet on the given world. @@ -152,7 +152,7 @@ public interface Economy { * @param worldName world-specific account. * @return if the UUID has an account. */ - public boolean hasAccount(UUID uuid, String worldName); + boolean hasAccount(UUID uuid, String worldName); /** * A method which changes the name associated with the given UUID in the @@ -163,7 +163,7 @@ public interface Economy { * Map map. * @return true if the name change is successful. */ - public boolean renameAccount(UUID uuid, String name); + boolean renameAccount(UUID uuid, String name); /* * Account balance related methods follow. @@ -175,7 +175,7 @@ public interface Economy { * @param uuid UUID of the account to get a balance for. * @return Amount currently held in account associated with the given UUID. */ - public BigDecimal getBalance(UUID uuid); + BigDecimal getBalance(UUID uuid); /** * Gets balance of a UUID on the specified world. IMPLEMENTATION SPECIFIC - if @@ -185,7 +185,7 @@ public interface Economy { * @param world name of the world. * @return Amount currently held in account associated with the given UUID. */ - public BigDecimal getBalance(UUID uuid, String world); + BigDecimal getBalance(UUID uuid, String world); /** * Checks if the account associated with the given UUID has the amount - DO NOT @@ -195,7 +195,7 @@ public interface Economy { * @param amount the amount to check for. * @return True if UUID has amount, False else wise. */ - public boolean has(UUID uuid, BigDecimal amount); + boolean has(UUID uuid, BigDecimal amount); /** * Checks if the account associated with the given UUID has the amount in the @@ -208,7 +208,7 @@ public interface Economy { * @return True if UUID has amount in the given world, * False else wise. */ - public boolean has(UUID uuid, String worldName, BigDecimal amount); + boolean has(UUID uuid, String worldName, BigDecimal amount); /** * Withdraw an amount from an account associated with a UUID - DO NOT USE @@ -220,7 +220,7 @@ public interface Economy { * {@link ResponseType} as to whether the transaction was a Success, * Failure, Unsupported. */ - public EconomyResponse withdraw(UUID uuid, BigDecimal amount); + EconomyResponse withdraw(UUID uuid, BigDecimal amount); /** * Withdraw an amount from an account associated with a UUID on a given world - @@ -234,7 +234,7 @@ public interface Economy { * {@link ResponseType} as to whether the transaction was a Success, * Failure, Unsupported. */ - public EconomyResponse withdraw(UUID uuid, String worldName, BigDecimal amount); + EconomyResponse withdraw(UUID uuid, String worldName, BigDecimal amount); /** * Deposit an amount to an account associated with the given UUID - DO NOT USE @@ -246,7 +246,7 @@ public interface Economy { * {@link ResponseType} as to whether the transaction was a Success, * Failure, Unsupported. */ - public EconomyResponse deposit(UUID uuid, BigDecimal amount); + EconomyResponse deposit(UUID uuid, BigDecimal amount); /** * Deposit an amount to an account associated with a UUID on a given world - @@ -260,7 +260,7 @@ public interface Economy { * {@link ResponseType} as to whether the transaction was a Success, * Failure, Unsupported. */ - public EconomyResponse deposit(UUID uuid, String worldName, BigDecimal amount); + EconomyResponse deposit(UUID uuid, String worldName, BigDecimal amount); /* * Bank methods follow. @@ -274,7 +274,7 @@ public interface Economy { * @param uuid UUID of the account should be linked to. * @return true if bank creation is successful. */ - public boolean createBank(String name, UUID uuid); + boolean createBank(String name, UUID uuid); /** * Deletes a bank account with the specified UUID. @@ -282,7 +282,7 @@ public interface Economy { * @param uuid UUID of the bank to be deleted. * @return true if the operation completed successfully */ - public boolean deleteBank(UUID uuid); + boolean deleteBank(UUID uuid); /** * Returns a map that represents all of the UUIDs which have banks in the @@ -292,7 +292,7 @@ public interface Economy { * @return a {@link Map} composed of the accounts keyed by their UUID, along * with their associated last-known-name. */ - public Map getBankUUIDNameMap(); + Map getBankUUIDNameMap(); /** * Gets the last known name of an bank with the given UUID. Required for @@ -301,7 +301,7 @@ public interface Economy { * @param uuid UUID to look up. * @return name of the bank. */ - public String getBankAccountName(UUID uuid); + String getBankAccountName(UUID uuid); /** * Checks if this UUID has a bank yet. @@ -309,7 +309,7 @@ public interface Economy { * @param uuid UUID to check. * @return true if the UUID has an account. */ - public boolean hasBankAccount(UUID uuid); + boolean hasBankAccount(UUID uuid); /** * A method which changes the name associated with the given UUID in the @@ -320,7 +320,7 @@ public interface Economy { * Map map. * @return true if the name change is successful. */ - public boolean renameBankAccount(UUID uuid, String name); + boolean renameBankAccount(UUID uuid, String name); /** * Returns the amount the bank has. @@ -328,7 +328,7 @@ public interface Economy { * @param uuid UUID of the account. * @return amount which the bank holds as a balance. */ - public BigDecimal bankBalance(UUID uuid); + BigDecimal bankBalance(UUID uuid); /** * Returns true or false whether the bank has the amount specified - DO NOT USE @@ -338,7 +338,7 @@ public interface Economy { * @param amount to check for * @return true if the bank has the given amount. */ - public boolean bankHas(UUID uuid, BigDecimal amount); + boolean bankHas(UUID uuid, BigDecimal amount); /** * Withdraw an amount from a bank account - DO NOT USE NEGATIVE AMOUNTS. @@ -349,7 +349,7 @@ public interface Economy { * {@link ResponseType} as to whether the transaction was a Success, * Failure, Unsupported. */ - public EconomyResponse bankWithdraw(String name, BigDecimal amount); + EconomyResponse bankWithdraw(String name, BigDecimal amount); /** * Deposit an amount into a bank account - DO NOT USE NEGATIVE AMOUNTS. @@ -360,7 +360,7 @@ public interface Economy { * {@link ResponseType} as to whether the transaction was a Success, * Failure, Unsupported. */ - public EconomyResponse bankDeposit(String name, BigDecimal amount); + EconomyResponse bankDeposit(String name, BigDecimal amount); /** * Check if a UUID is the owner of a bank account. @@ -369,7 +369,7 @@ public interface Economy { * @param bankUUID UUID of the bank account to check ownership of. * @return true if the uuid is the owner of the bank associated with bankUUID. */ - public boolean isBankOwner(UUID uuid, UUID bankUUID); + boolean isBankOwner(UUID uuid, UUID bankUUID); /** * Check if the UUID is a member of the bank account @@ -378,12 +378,12 @@ public interface Economy { * @param bankUUID UUID of the bank account to check membership of. * @return @return true if the uuid is a member of the bank associated with bankUUID. */ - public boolean isBankMember(UUID uuid, UUID bankUUID); + boolean isBankMember(UUID uuid, UUID bankUUID); /** * Gets the list of banks' UUIDs. * * @return the List of Banks' UUIDs. */ - public List getBanks(); + List getBanks(); } diff --git a/src/main/java/net/milkbowl/vault2/economy/EconomyResponse.java b/src/main/java/net/milkbowl/vault2/economy/EconomyResponse.java index 7e00634..6b6a881 100644 --- a/src/main/java/net/milkbowl/vault2/economy/EconomyResponse.java +++ b/src/main/java/net/milkbowl/vault2/economy/EconomyResponse.java @@ -29,7 +29,7 @@ public class EconomyResponse { /** * Enum for types of Responses indicating the status of a method call. */ - public static enum ResponseType { + public enum ResponseType { SUCCESS(1), FAILURE(2), NOT_IMPLEMENTED(3); From eb5b5c64965c6c794411819815346ba341a21fe4 Mon Sep 17 00:00:00 2001 From: Daniel V Date: Wed, 12 Jun 2024 12:55:11 -0400 Subject: [PATCH 23/95] Multicurrency support, and plugin name for transactions to attach source to them. --- .../net/milkbowl/vault2/economy/Economy.java | 255 ++++++++++++++---- 1 file changed, 210 insertions(+), 45 deletions(-) diff --git a/src/main/java/net/milkbowl/vault2/economy/Economy.java b/src/main/java/net/milkbowl/vault2/economy/Economy.java index 4e5bc00..9565fd4 100644 --- a/src/main/java/net/milkbowl/vault2/economy/Economy.java +++ b/src/main/java/net/milkbowl/vault2/economy/Economy.java @@ -54,6 +54,13 @@ public interface Economy { */ boolean hasBankSupport(); + /** + * Returns true if the economy plugin supports multiple currencies. + * + * @return true if the economy plugin supports multiple currencies. + */ + boolean hasMultiCurrencySupport(); + /* * Currency-related methods follow. */ @@ -69,29 +76,56 @@ public interface Economy { int fractionalDigits(); /** - * Plugins use this method to format a given BigDecimal amount into a human - * readable amount using your economy plugin's currency names/conventions. + * Plugins use this method to format a given BigDecimal amount into a human-readable + * amount using your economy plugin's currency names/conventions. * * @param amount to format. - * @return Human readable string describing amount, ie 5 Dollars or 5.55 Pounds. + * @param currency the currency to use for the format. + * + * @return Human-readable string describing amount, ie 5 Dollars or 5.55 Pounds. */ - String format(BigDecimal amount); + String format(BigDecimal amount, String currency); /** - * 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 true if a currency with the specified name exists. + * + * @param currency the currency to use. + * + * @return true if a currency with the specified name exists. + */ + boolean hasCurrency(String currency); + + /** + * Returns the default currency that is able to be used in API operations. May not be human-readable. * + * @return name of the currency i.e.: USD + */ + String defaultCurrency(); + + /** + * Returns the name of the default 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) ie: Dollars or Pounds. */ - String currencyNamePlural(); + String defaultCurrencyNamePlural(); /** - * Returns the name of the currency in singular form. If the economy being used + * Returns the name of the default 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) ie: Dollar or Pound. */ - String currencyNameSingular(); + String defaultCurrencyNameSingular(); + + /** + * Returns a list of currencies used by the economy plugin. These are able to be used + * in the calls in the methods of the API. May not be human-readable. + * + * @return list of currencies used by the economy plugin. These are able to be used + * in the calls in the methods of the API. + */ + List currencies(); /* * Account-related methods follow. @@ -119,7 +153,7 @@ public interface Economy { boolean createAccount(UUID uuid, String name, String worldName); /** - * Returns a map that represents all of the UUIDs which have accounts in the + * Returns a map that represents all 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. * @@ -171,96 +205,163 @@ public interface Economy { /** * Gets balance of an account associated with a UUID. - * + * + * @param pluginName The name of the plugin that is calling the method. * @param uuid UUID of the account to get a balance for. * @return Amount currently held in account associated with the given UUID. */ - BigDecimal getBalance(UUID uuid); + BigDecimal getBalance(String pluginName, 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 pluginName The name of the plugin that is calling the method. + * @param uuid 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. + */ + BigDecimal getBalance(String pluginName, UUID uuid, String world); + + /** + * 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 pluginName The name of the plugin that is calling the method. * @param uuid UUID of the account to get a balance for. * @param world name of the world. + * @param currency the currency to use. * @return Amount currently held in account associated with the given UUID. */ - BigDecimal getBalance(UUID uuid, String world); + BigDecimal getBalance(String pluginName, UUID uuid, String world, String currency); /** * Checks if the account associated with the given UUID has the amount - DO NOT * USE NEGATIVE AMOUNTS. - * + * + * @param pluginName The name of the plugin that is calling the method. * @param uuid the UUID associated with the account to check the balance of. * @param amount the amount to check for. * @return True if UUID has amount, False else wise. */ - boolean has(UUID uuid, BigDecimal amount); + boolean has(String pluginName, UUID uuid, BigDecimal 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 pluginName The name of the plugin that is calling the method. * @param uuid the UUID associated with the account to check the balance of. * @param worldName the name of the world to check in. * @param amount the amount to check for. * @return True if UUID has amount in the given world, * False else wise. */ - boolean has(UUID uuid, String worldName, BigDecimal amount); + boolean has(String pluginName, UUID uuid, String worldName, BigDecimal 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 pluginName The name of the plugin that is calling the method. + * @param uuid the UUID associated with the account to check the balance of. + * @param worldName the name of the world to check in. + * @param currency the currency to use. + * @param amount the amount to check for. + * @return True if UUID has amount in the given world, + * False else wise. + */ + boolean has(String pluginName, UUID uuid, String worldName, String currency, BigDecimal amount); /** * Withdraw an amount from an account associated with a UUID - DO NOT USE * NEGATIVE AMOUNTS. - * + * + * @param pluginName The name of the plugin that is calling the method. * @param uuid the UUID associated with the account to withdraw from. * @param amount Amount to withdraw. * @return {@link EconomyResponse} which includes the Economy plugin's * {@link ResponseType} as to whether the transaction was a Success, * Failure, Unsupported. */ - EconomyResponse withdraw(UUID uuid, BigDecimal amount); + EconomyResponse withdraw(String pluginName, UUID uuid, BigDecimal 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 pluginName The name of the plugin that is calling the method. + * @param uuid the UUID associated with the account to withdraw from. + * @param worldName the name of the world to check in. + * @param amount Amount to withdraw. + * @return {@link EconomyResponse} which includes the Economy plugin's + * {@link ResponseType} as to whether the transaction was a Success, + * Failure, Unsupported. + */ + EconomyResponse withdraw(String pluginName, UUID uuid, String worldName, BigDecimal 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 pluginName The name of the plugin that is calling the method. * @param uuid the UUID associated with the account to withdraw from. * @param worldName the name of the world to check in. + * @param currency the currency to use. * @param amount Amount to withdraw. * @return {@link EconomyResponse} which includes the Economy plugin's * {@link ResponseType} as to whether the transaction was a Success, * Failure, Unsupported. */ - EconomyResponse withdraw(UUID uuid, String worldName, BigDecimal amount); + EconomyResponse withdraw(String pluginName, UUID uuid, String worldName, String currency, BigDecimal amount); /** * Deposit an amount to an account associated with the given UUID - DO NOT USE * NEGATIVE AMOUNTS. - * + * + * @param pluginName The name of the plugin that is calling the method. * @param uuid the UUID associated with the account to deposit to. * @param amount Amount to deposit. * @return {@link EconomyResponse} which includes the Economy plugin's * {@link ResponseType} as to whether the transaction was a Success, * Failure, Unsupported. */ - EconomyResponse deposit(UUID uuid, BigDecimal amount); + EconomyResponse deposit(String pluginName, UUID uuid, BigDecimal amount); /** * Deposit an amount to 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 pluginName The name of the plugin that is calling the method. + * @param uuid the UUID associated with the account to deposit to. + * @param worldName the name of the world to check in. + * @param amount Amount to deposit. + * @return {@link EconomyResponse} which includes the Economy plugin's + * {@link ResponseType} as to whether the transaction was a Success, + * Failure, Unsupported. + */ + EconomyResponse deposit(String pluginName, UUID uuid, String worldName, BigDecimal amount); + + /** + * Deposit an amount to 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 pluginName The name of the plugin that is calling the method. * @param uuid the UUID associated with the account to deposit to. * @param worldName the name of the world to check in. + * @param currency the currency to use. * @param amount Amount to deposit. * @return {@link EconomyResponse} which includes the Economy plugin's * {@link ResponseType} as to whether the transaction was a Success, * Failure, Unsupported. */ - EconomyResponse deposit(UUID uuid, String worldName, BigDecimal amount); + EconomyResponse deposit(String pluginName, UUID uuid, String worldName, String currency, BigDecimal amount); /* * Bank methods follow. @@ -269,20 +370,22 @@ public interface Economy { /** * Creates a bank account with the specified name and the given UUID as the * owner. - * + * + * @param pluginName The name of the plugin that is calling the method. * @param name Name of account. * @param uuid UUID of the account should be linked to. * @return true if bank creation is successful. */ - boolean createBank(String name, UUID uuid); + boolean createBank(String pluginName, String name, UUID uuid); /** * Deletes a bank account with the specified UUID. - * + * + * @param pluginName The name of the plugin that is calling the method. * @param uuid UUID of the bank to be deleted. * @return true if the operation completed successfully */ - boolean deleteBank(UUID uuid); + boolean deleteBank(String pluginName, UUID uuid); /** * Returns a map that represents all of the UUIDs which have banks in the @@ -297,7 +400,7 @@ public interface Economy { /** * Gets the last known name of an bank with the given UUID. Required for * messages to be more human-readable than UUIDs alone can provide. - * + * * @param uuid UUID to look up. * @return name of the bank. */ @@ -305,66 +408,128 @@ public interface Economy { /** * Checks if this UUID has a bank yet. - * + * * @param uuid UUID to check. * @return true if the UUID has an account. */ boolean hasBankAccount(UUID uuid); + /** + * Checks if the specified bank account supports the specified currency. + * + * @param uuid UUID of the account. + * @param currency the currency to use. + * @return true if the bank supports the currency + */ + boolean bankSupportsCurrency(UUID uuid, String currency); + /** * A method which changes the name associated with the given UUID in the * Map received from {@link #getBankUUIDNameMap()}. - * + * + * @param pluginName The name of the plugin that is calling the method. * @param uuid UUID which is having a name change. * @param name name that will be associated with the UUID in the * Map map. * @return true if the name change is successful. */ - boolean renameBankAccount(UUID uuid, String name); + boolean renameBankAccount(String pluginName, UUID uuid, String name); /** * Returns the amount the bank has. - * + * + * @param pluginName The name of the plugin that is calling the method. + * @param uuid UUID of the account. + * @return amount which the bank holds as a balance. + */ + BigDecimal bankBalance(String pluginName, UUID uuid); + + /** + * Returns the amount the bank has. + * + * @param pluginName The name of the plugin that is calling the method. * @param uuid UUID of the account. + * @param currency the currency to use. * @return amount which the bank holds as a balance. */ - BigDecimal bankBalance(UUID uuid); + BigDecimal bankBalance(String pluginName, UUID uuid, String currency); /** * Returns true or false whether the bank has the amount specified - DO NOT USE * NEGATIVE AMOUNTS. - * + * + * @param pluginName The name of the plugin that is calling the method. * @param uuid UUID of the account. * @param amount to check for * @return true if the bank has the given amount. */ - boolean bankHas(UUID uuid, BigDecimal amount); + boolean bankHas(String pluginName, UUID uuid, BigDecimal amount); + + /** + * Returns true or false whether the bank has the amount specified - DO NOT USE + * NEGATIVE AMOUNTS. + * + * @param pluginName The name of the plugin that is calling the method. + * @param uuid UUID of the account. + * @param currency the currency to use. + * @param amount to check for + * @return true if the bank has the given amount. + */ + boolean bankHas(String pluginName, UUID uuid, String currency, BigDecimal amount); /** * Withdraw an amount from a bank account - DO NOT USE NEGATIVE AMOUNTS. - * + * + * @param pluginName The name of the plugin that is calling the method. + * @param uuid UUID of the account. + * @param amount to withdraw. + * @return {@link EconomyResponse} which includes the Economy plugin's + * {@link ResponseType} as to whether the transaction was a Success, + * Failure, Unsupported. + */ + EconomyResponse bankWithdraw(String pluginName, UUID uuid, BigDecimal amount); + + /** + * Withdraw an amount from a bank account - DO NOT USE NEGATIVE AMOUNTS. + * + * @param pluginName The name of the plugin that is calling the method. * @param uuid UUID of the account. + * @param currency the currency to use. * @param amount to withdraw. * @return {@link EconomyResponse} which includes the Economy plugin's * {@link ResponseType} as to whether the transaction was a Success, * Failure, Unsupported. */ - EconomyResponse bankWithdraw(String name, BigDecimal amount); + EconomyResponse bankWithdraw(String pluginName, UUID uuid, String currency, BigDecimal amount); /** * Deposit an amount into a bank account - DO NOT USE NEGATIVE AMOUNTS. - * + * + * @param pluginName The name of the plugin that is calling the method. + * @param uuid UUID of the account. + * @param amount to deposit. + * @return {@link EconomyResponse} which includes the Economy plugin's + * {@link ResponseType} as to whether the transaction was a Success, + * Failure, Unsupported. + */ + EconomyResponse bankDeposit(String pluginName, UUID uuid, BigDecimal amount); + + /** + * Deposit an amount into a bank account - DO NOT USE NEGATIVE AMOUNTS. + * + * @param pluginName The name of the plugin that is calling the method. * @param uuid UUID of the account. + * @param currency the currency to use. * @param amount to deposit. * @return {@link EconomyResponse} which includes the Economy plugin's * {@link ResponseType} as to whether the transaction was a Success, * Failure, Unsupported. */ - EconomyResponse bankDeposit(String name, BigDecimal amount); + EconomyResponse bankDeposit(String pluginName, UUID uuid, String currency, BigDecimal amount); /** * Check if a UUID is the owner of a bank account. - * + * * @param uuid UUID of the player/object who might be an owner. * @param bankUUID UUID of the bank account to check ownership of. * @return true if the uuid is the owner of the bank associated with bankUUID. @@ -373,8 +538,8 @@ public interface Economy { /** * Check if the UUID is a member of the bank account - * - * @param uuid UUID of the player/object who might be a member.. + * + * @param uuid UUID of the player/object who might be a member. * @param bankUUID UUID of the bank account to check membership of. * @return @return true if the uuid is a member of the bank associated with bankUUID. */ From b4ff40974d9100074e129df0f3ea1d94ee92651c Mon Sep 17 00:00:00 2001 From: Daniel V Date: Wed, 12 Jun 2024 13:34:42 -0400 Subject: [PATCH 24/95] List -> collection. --- src/main/java/net/milkbowl/vault2/economy/Economy.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/milkbowl/vault2/economy/Economy.java b/src/main/java/net/milkbowl/vault2/economy/Economy.java index 9565fd4..f2bd0d8 100644 --- a/src/main/java/net/milkbowl/vault2/economy/Economy.java +++ b/src/main/java/net/milkbowl/vault2/economy/Economy.java @@ -17,6 +17,7 @@ package net.milkbowl.vault2.economy; import java.math.BigDecimal; +import java.util.Collection; import java.util.List; import java.util.Map; import java.util.UUID; @@ -125,7 +126,7 @@ public interface Economy { * @return list of currencies used by the economy plugin. These are able to be used * in the calls in the methods of the API. */ - List currencies(); + Collection currencies(); /* * Account-related methods follow. @@ -550,5 +551,5 @@ public interface Economy { * * @return the List of Banks' UUIDs. */ - List getBanks(); + Collection getBanks(); } From 9f70379f9f501a61dd27a6375b8fa89d930694ea Mon Sep 17 00:00:00 2001 From: Daniel V Date: Wed, 12 Jun 2024 13:45:36 -0400 Subject: [PATCH 25/95] Optional for last known name since it could not exist depending on calls done before. --- src/main/java/net/milkbowl/vault2/economy/Economy.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/milkbowl/vault2/economy/Economy.java b/src/main/java/net/milkbowl/vault2/economy/Economy.java index f2bd0d8..b76b467 100644 --- a/src/main/java/net/milkbowl/vault2/economy/Economy.java +++ b/src/main/java/net/milkbowl/vault2/economy/Economy.java @@ -20,6 +20,7 @@ import java.util.Collection; import java.util.List; import java.util.Map; +import java.util.Optional; import java.util.UUID; import net.milkbowl.vault2.economy.EconomyResponse.ResponseType; @@ -168,9 +169,10 @@ public interface Economy { * messages to be more human-readable than UUIDs alone can provide. * * @param uuid UUID associated with the account. - * @return name of the account owner. + * @return An optional containing the last known name if the account exists, otherwise an empty + * optional. */ - String getAccountName(UUID uuid); + Optional getAccountName(UUID uuid); /** * Checks if this UUID has an account yet. From 41028bee0a1768bbec96420a6ceac2f125be2b27 Mon Sep 17 00:00:00 2001 From: Daniel V Date: Wed, 12 Jun 2024 14:13:03 -0400 Subject: [PATCH 26/95] Add alt format method. --- src/main/java/net/milkbowl/vault2/economy/Economy.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/net/milkbowl/vault2/economy/Economy.java b/src/main/java/net/milkbowl/vault2/economy/Economy.java index b76b467..6dbba51 100644 --- a/src/main/java/net/milkbowl/vault2/economy/Economy.java +++ b/src/main/java/net/milkbowl/vault2/economy/Economy.java @@ -77,6 +77,16 @@ public interface Economy { */ int fractionalDigits(); + /** + * Plugins use this method to format a given BigDecimal amount into a human-readable + * amount using your economy plugin's currency names/conventions. + * + * @param amount to format. + * + * @return Human-readable string describing amount, ie 5 Dollars or 5.55 Pounds. + */ + String format(BigDecimal amount); + /** * Plugins use this method to format a given BigDecimal amount into a human-readable * amount using your economy plugin's currency names/conventions. From b4267e3cc118aa97928ad197653402d9e4e969bd Mon Sep 17 00:00:00 2001 From: Daniel V Date: Wed, 12 Jun 2024 14:19:18 -0400 Subject: [PATCH 27/95] Update pom. --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index a45a3b1..9c84348 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 net.milkbowl.vault VaultUnlockedAPI - 2.0 + 2.1 VaultUnlockedAPI From a36fcb4dd2fde5f5ba2f3fd2c63631a0561b5eb0 Mon Sep 17 00:00:00 2001 From: Daniel V Date: Wed, 12 Jun 2024 14:19:40 -0400 Subject: [PATCH 28/95] Update pom. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0ba58d7..896f824 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ How to include the API with Maven: net.milkbowl.vault VaultUnlockedAPI - 2.0 + 2.1 provided @@ -24,7 +24,7 @@ repositories { maven { url 'https://repo.codemc.org/repository/maven-public' } } dependencies { - compileOnly "net.milkbowl.vault:VaultUnlockedAPI:2.0" + compileOnly "net.milkbowl.vault:VaultUnlockedAPI:2.1" } ``` From 4f68b49ed59f48a67dc0249a5f4d7fe02236001b Mon Sep 17 00:00:00 2001 From: Daniel V Date: Thu, 13 Jun 2024 09:56:33 -0400 Subject: [PATCH 29/95] Add NotNull to specific methods for clarity. --- pom.xml | 8 ++++- .../net/milkbowl/vault2/economy/Economy.java | 36 ++++++++++++++++--- 2 files changed, 38 insertions(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index 9c84348..3b04f6a 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 net.milkbowl.vault VaultUnlockedAPI - 2.1 + 2.2 VaultUnlockedAPI @@ -83,6 +83,12 @@ test true + + org.jetbrains + annotations + 24.0.0 + compile + diff --git a/src/main/java/net/milkbowl/vault2/economy/Economy.java b/src/main/java/net/milkbowl/vault2/economy/Economy.java index 6dbba51..cad75df 100644 --- a/src/main/java/net/milkbowl/vault2/economy/Economy.java +++ b/src/main/java/net/milkbowl/vault2/economy/Economy.java @@ -24,6 +24,7 @@ import java.util.UUID; import net.milkbowl.vault2.economy.EconomyResponse.ResponseType; +import org.jetbrains.annotations.NotNull; /** * The main economy API @@ -47,6 +48,7 @@ public interface Economy { * * @return Name of the active economy plugin on the server. */ + @NotNull String getName(); /** @@ -75,6 +77,7 @@ public interface Economy { * @return number of digits after the decimal point this plugin supports or -1 * if no rounding occurs. */ + @NotNull int fractionalDigits(); /** @@ -85,6 +88,7 @@ public interface Economy { * * @return Human-readable string describing amount, ie 5 Dollars or 5.55 Pounds. */ + @NotNull String format(BigDecimal amount); /** @@ -96,6 +100,7 @@ public interface Economy { * * @return Human-readable string describing amount, ie 5 Dollars or 5.55 Pounds. */ + @NotNull String format(BigDecimal amount, String currency); /** @@ -108,11 +113,14 @@ public interface Economy { boolean hasCurrency(String currency); /** - * Returns the default currency that is able to be used in API operations. May not be human-readable. - * - * @return name of the currency i.e.: USD + * Used to get the default currency. This could be the default currency for the server globally or + * for the default world if the implementation supports multi-world. + * @return The currency that is the default for the server if multi-world support is not available + * otherwise the default for the default world. + * */ - String defaultCurrency(); + @NotNull + String getDefaultCurrency(); /** * Returns the name of the default currency in plural form. If the economy being used @@ -120,6 +128,7 @@ public interface Economy { * * @return name of the currency (plural) ie: Dollars or Pounds. */ + @NotNull String defaultCurrencyNamePlural(); /** @@ -128,6 +137,7 @@ public interface Economy { * * @return name of the currency (singular) ie: Dollar or Pound. */ + @NotNull String defaultCurrencyNameSingular(); /** @@ -223,6 +233,7 @@ public interface Economy { * @param uuid UUID of the account to get a balance for. * @return Amount currently held in account associated with the given UUID. */ + @NotNull BigDecimal getBalance(String pluginName, UUID uuid); /** @@ -234,6 +245,7 @@ public interface Economy { * @param world name of the world. * @return Amount currently held in account associated with the given UUID. */ + @NotNull BigDecimal getBalance(String pluginName, UUID uuid, String world); /** @@ -246,6 +258,7 @@ public interface Economy { * @param currency the currency to use. * @return Amount currently held in account associated with the given UUID. */ + @NotNull BigDecimal getBalance(String pluginName, UUID uuid, String world, String currency); /** @@ -299,6 +312,7 @@ public interface Economy { * {@link ResponseType} as to whether the transaction was a Success, * Failure, Unsupported. */ + @NotNull EconomyResponse withdraw(String pluginName, UUID uuid, BigDecimal amount); /** @@ -314,6 +328,7 @@ public interface Economy { * {@link ResponseType} as to whether the transaction was a Success, * Failure, Unsupported. */ + @NotNull EconomyResponse withdraw(String pluginName, UUID uuid, String worldName, BigDecimal amount); /** @@ -330,6 +345,7 @@ public interface Economy { * {@link ResponseType} as to whether the transaction was a Success, * Failure, Unsupported. */ + @NotNull EconomyResponse withdraw(String pluginName, UUID uuid, String worldName, String currency, BigDecimal amount); /** @@ -343,6 +359,7 @@ public interface Economy { * {@link ResponseType} as to whether the transaction was a Success, * Failure, Unsupported. */ + @NotNull EconomyResponse deposit(String pluginName, UUID uuid, BigDecimal amount); /** @@ -358,6 +375,7 @@ public interface Economy { * {@link ResponseType} as to whether the transaction was a Success, * Failure, Unsupported. */ + @NotNull EconomyResponse deposit(String pluginName, UUID uuid, String worldName, BigDecimal amount); /** @@ -374,6 +392,7 @@ public interface Economy { * {@link ResponseType} as to whether the transaction was a Success, * Failure, Unsupported. */ + @NotNull EconomyResponse deposit(String pluginName, UUID uuid, String worldName, String currency, BigDecimal amount); /* @@ -401,7 +420,7 @@ public interface Economy { boolean deleteBank(String pluginName, UUID uuid); /** - * Returns a map that represents all of the UUIDs which have banks in the + * Returns a map that represents all the UUIDs which have banks 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. * @@ -417,6 +436,7 @@ public interface Economy { * @param uuid UUID to look up. * @return name of the bank. */ + @NotNull String getBankAccountName(UUID uuid); /** @@ -455,6 +475,7 @@ public interface Economy { * @param uuid UUID of the account. * @return amount which the bank holds as a balance. */ + @NotNull BigDecimal bankBalance(String pluginName, UUID uuid); /** @@ -465,6 +486,7 @@ public interface Economy { * @param currency the currency to use. * @return amount which the bank holds as a balance. */ + @NotNull BigDecimal bankBalance(String pluginName, UUID uuid, String currency); /** @@ -500,6 +522,7 @@ public interface Economy { * {@link ResponseType} as to whether the transaction was a Success, * Failure, Unsupported. */ + @NotNull EconomyResponse bankWithdraw(String pluginName, UUID uuid, BigDecimal amount); /** @@ -513,6 +536,7 @@ public interface Economy { * {@link ResponseType} as to whether the transaction was a Success, * Failure, Unsupported. */ + @NotNull EconomyResponse bankWithdraw(String pluginName, UUID uuid, String currency, BigDecimal amount); /** @@ -525,6 +549,7 @@ public interface Economy { * {@link ResponseType} as to whether the transaction was a Success, * Failure, Unsupported. */ + @NotNull EconomyResponse bankDeposit(String pluginName, UUID uuid, BigDecimal amount); /** @@ -538,6 +563,7 @@ public interface Economy { * {@link ResponseType} as to whether the transaction was a Success, * Failure, Unsupported. */ + @NotNull EconomyResponse bankDeposit(String pluginName, UUID uuid, String currency, BigDecimal amount); /** From f60ac4f3a26ef260a2b241a2b5a2de25959de6b8 Mon Sep 17 00:00:00 2001 From: Daniel V Date: Thu, 13 Jun 2024 10:03:16 -0400 Subject: [PATCH 30/95] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 896f824..ce3d0f3 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ How to include the API with Maven: net.milkbowl.vault VaultUnlockedAPI - 2.1 + 2.2 provided From f158f980faa7b16b3665725d4c63d8e420d89f51 Mon Sep 17 00:00:00 2001 From: Daniel V Date: Sat, 10 Aug 2024 23:15:27 -0400 Subject: [PATCH 31/95] Update version. --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 3b04f6a..d61402b 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 net.milkbowl.vault VaultUnlockedAPI - 2.2 + 2.3 VaultUnlockedAPI From 92bc7ae92a75584bf1ca1a491f008fd1cb948cea Mon Sep 17 00:00:00 2001 From: Daniel V Date: Sun, 25 Aug 2024 08:13:36 -0400 Subject: [PATCH 32/95] Update Version; Readd AbstractEconomy to old source branch. --- README.md | 4 +- pom.xml | 2 +- .../vault/economy/AbstractEconomy.java | 87 +++++++++++++++++++ 3 files changed, 90 insertions(+), 3 deletions(-) create mode 100644 src/main/java/net/milkbowl/vault/economy/AbstractEconomy.java diff --git a/README.md b/README.md index ce3d0f3..366f881 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ How to include the API with Maven: net.milkbowl.vault VaultUnlockedAPI - 2.2 + 2.4 provided @@ -24,7 +24,7 @@ repositories { maven { url 'https://repo.codemc.org/repository/maven-public' } } dependencies { - compileOnly "net.milkbowl.vault:VaultUnlockedAPI:2.1" + compileOnly "net.milkbowl.vault:VaultUnlockedAPI:2.4" } ``` diff --git a/pom.xml b/pom.xml index d61402b..bd6ef4b 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 net.milkbowl.vault VaultUnlockedAPI - 2.3 + 2.4 VaultUnlockedAPI diff --git a/src/main/java/net/milkbowl/vault/economy/AbstractEconomy.java b/src/main/java/net/milkbowl/vault/economy/AbstractEconomy.java new file mode 100644 index 0000000..00a1523 --- /dev/null +++ b/src/main/java/net/milkbowl/vault/economy/AbstractEconomy.java @@ -0,0 +1,87 @@ +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); + } + +} \ No newline at end of file From 741f317f4bde909365f0e7d33bf75ff00e07aa9a Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Fri, 30 Aug 2024 10:38:27 -0400 Subject: [PATCH 33/95] Replace banks with accounts that have members and permissions. --- pom.xml | 2 +- .../vault2/economy/AccountPermission.java | 37 ++ .../net/milkbowl/vault2/economy/Economy.java | 336 +++++++----------- 3 files changed, 168 insertions(+), 207 deletions(-) create mode 100644 src/main/java/net/milkbowl/vault2/economy/AccountPermission.java diff --git a/pom.xml b/pom.xml index bd6ef4b..0ebc17e 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 net.milkbowl.vault VaultUnlockedAPI - 2.4 + 2.5 VaultUnlockedAPI diff --git a/src/main/java/net/milkbowl/vault2/economy/AccountPermission.java b/src/main/java/net/milkbowl/vault2/economy/AccountPermission.java new file mode 100644 index 0000000..b604263 --- /dev/null +++ b/src/main/java/net/milkbowl/vault2/economy/AccountPermission.java @@ -0,0 +1,37 @@ +package net.milkbowl.vault2.economy; +/* + * The New Kings + * Copyright (C) 2022 - 2024 Daniel "creatorfromhell" Vidmar + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +/** + * AccountPermission + * + * @author creatorfromhell + * @since 0.0.1.0 + */ +public enum AccountPermission { + + DEPOSIT, + WITHDRAW, + BALANCE, + TRANSFER_OWNERSHIP, + INVITE_MEMBER, + REMOVE_MEMBER, + CHANGE_MEMBER_PERMISSION, + OWNER, + DELETE +} \ No newline at end of file diff --git a/src/main/java/net/milkbowl/vault2/economy/Economy.java b/src/main/java/net/milkbowl/vault2/economy/Economy.java index cad75df..24e07b7 100644 --- a/src/main/java/net/milkbowl/vault2/economy/Economy.java +++ b/src/main/java/net/milkbowl/vault2/economy/Economy.java @@ -16,16 +16,15 @@ package net.milkbowl.vault2.economy; +import net.milkbowl.vault2.economy.EconomyResponse.ResponseType; +import org.jetbrains.annotations.NotNull; + import java.math.BigDecimal; import java.util.Collection; -import java.util.List; import java.util.Map; import java.util.Optional; import java.util.UUID; -import net.milkbowl.vault2.economy.EconomyResponse.ResponseType; -import org.jetbrains.annotations.NotNull; - /** * The main economy API * @@ -52,11 +51,11 @@ public interface Economy { String getName(); /** - * Returns true if the economy plugin supports banks. - * - * @return true if the economy plugin supports banks. + * Returns true if the economy plugin supports shared accounts. + * + * @return true if the economy plugin supports shared accounts. */ - boolean hasBankSupport(); + boolean hasSharedAccountSupport(); /** * Returns true if the economy plugin supports multiple currencies. @@ -101,7 +100,7 @@ public interface Economy { * @return Human-readable string describing amount, ie 5 Dollars or 5.55 Pounds. */ @NotNull - String format(BigDecimal amount, String currency); + String format(BigDecimal amount, final String currency); /** * Returns true if a currency with the specified name exists. @@ -110,7 +109,7 @@ public interface Economy { * * @return true if a currency with the specified name exists. */ - boolean hasCurrency(String currency); + boolean hasCurrency(final String currency); /** * Used to get the default currency. This could be the default currency for the server globally or @@ -156,23 +155,23 @@ public interface Economy { /** * Attempts to create a account for the given UUID. * - * @param uuid UUID associated with the account. + * @param accountID UUID associated with the account. * @param name UUID associated with the account. * @return true if the account creation was successful. */ - boolean createAccount(UUID uuid, String name); + boolean createAccount(UUID accountID, final 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 UUID associated with the account. + * @param accountID UUID associated with the account. * @param name UUID associated with the account. * @param worldName String name of the world. * @return if the account creation was successful */ - boolean createAccount(UUID uuid, String name, String worldName); + boolean createAccount(UUID accountID, final String name, final String worldName); /** * Returns a map that represents all the UUIDs which have accounts in the @@ -188,89 +187,110 @@ public interface Economy { * 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 associated with the account. + * @param accountID UUID associated with the account. * @return An optional containing the last known name if the account exists, otherwise an empty * optional. */ - Optional getAccountName(UUID uuid); + Optional getAccountName(UUID accountID); /** * Checks if this UUID has an account yet. * - * @param uuid UUID to check for an existing account. + * @param accountID UUID to check for an existing account. * @return true if the UUID has an account. */ - boolean hasAccount(UUID uuid); + boolean hasAccount(UUID accountID); /** * Checks if this UUID has an account yet on the given world. * - * @param uuid UUID to check for an existing account. + * @param accountID UUID to check for an existing account. * @param worldName world-specific account. * @return if the UUID has an account. */ - boolean hasAccount(UUID uuid, String worldName); + boolean hasAccount(UUID accountID, final String worldName); /** * A method which changes the name associated with the given UUID in the - * Map received from {@link #getUUIDNameMap()}. + * Map received from {@link #getUUIDNameMap()}. * - * @param uuid UUID whose account is having a name change. + * @param accountID UUID whose account is having a name change. * @param name String name that will be associated with the UUID in the - * Map map. + * Map map. * @return true if the name change is successful. */ - boolean renameAccount(UUID uuid, String name); + boolean renameAccount(UUID accountID, final String name); /* * Account balance related methods follow. */ + /** + * Determines whether an account supports a specific currency. + * + * @param plugin the name of the plugin + * @param accountID the UUID of the account + * @param currency the currency to check support for + * @return true if the account supports the currency, false otherwise + */ + boolean accountSupportsCurrency(final String plugin, final UUID accountID, final String currency); + + /** + * Checks if the given account supports the specified currency in the given world. + * + * @param plugin the name of the plugin requesting the check + * @param accountID the UUID of the player account + * @param currency the currency code to check support for + * @param world the name of the world to check in + * @return true if the account supports the currency in the world, false otherwise + */ + boolean accountSupportsCurrency(final String plugin, final UUID accountID, final String currency, final String world); + /** * Gets balance of an account associated with a UUID. * * @param pluginName The name of the plugin that is calling the method. - * @param uuid UUID of the account to get a balance for. + * @param accountID UUID of the account to get a balance for. * @return Amount currently held in account associated with the given UUID. */ @NotNull - BigDecimal getBalance(String pluginName, UUID uuid); + BigDecimal getBalance(final String pluginName, final UUID accountID); /** * 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 pluginName The name of the plugin that is calling the method. - * @param uuid UUID of the account to get a balance for. + * @param accountID 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. */ @NotNull - BigDecimal getBalance(String pluginName, UUID uuid, String world); + BigDecimal getBalance(final String pluginName, final UUID accountID, final String world); /** * 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 pluginName The name of the plugin that is calling the method. - * @param uuid UUID of the account to get a balance for. + * @param accountID UUID of the account to get a balance for. * @param world name of the world. * @param currency the currency to use. * @return Amount currently held in account associated with the given UUID. */ @NotNull - BigDecimal getBalance(String pluginName, UUID uuid, String world, String currency); + BigDecimal getBalance(final String pluginName, final UUID accountID, final String world, final String currency); /** * Checks if the account associated with the given UUID has the amount - DO NOT * USE NEGATIVE AMOUNTS. * * @param pluginName The name of the plugin that is calling the method. - * @param uuid the UUID associated with the account to check the balance of. + * @param accountID the UUID associated with the account to check the balance of. * @param amount the amount to check for. * @return True if UUID has amount, False else wise. */ - boolean has(String pluginName, UUID uuid, BigDecimal amount); + boolean has(final String pluginName, final UUID accountID, final BigDecimal amount); /** * Checks if the account associated with the given UUID has the amount in the @@ -278,13 +298,13 @@ public interface Economy { * economy plugin does not support this the global balance will be returned. * * @param pluginName The name of the plugin that is calling the method. - * @param uuid the UUID associated with the account to check the balance of. + * @param accountID the UUID associated with the account to check the balance of. * @param worldName the name of the world to check in. * @param amount the amount to check for. * @return True if UUID has amount in the given world, * False else wise. */ - boolean has(String pluginName, UUID uuid, String worldName, BigDecimal amount); + boolean has(final String pluginName, final UUID accountID, final String worldName, final BigDecimal amount); /** * Checks if the account associated with the given UUID has the amount in the @@ -292,28 +312,28 @@ public interface Economy { * economy plugin does not support this the global balance will be returned. * * @param pluginName The name of the plugin that is calling the method. - * @param uuid the UUID associated with the account to check the balance of. + * @param accountID the UUID associated with the account to check the balance of. * @param worldName the name of the world to check in. * @param currency the currency to use. * @param amount the amount to check for. * @return True if UUID has amount in the given world, * False else wise. */ - boolean has(String pluginName, UUID uuid, String worldName, String currency, BigDecimal amount); + boolean has(final String pluginName, final UUID accountID, final String worldName, final String currency, final BigDecimal amount); /** * Withdraw an amount from an account associated with a UUID - DO NOT USE * NEGATIVE AMOUNTS. * * @param pluginName The name of the plugin that is calling the method. - * @param uuid the UUID associated with the account to withdraw from. + * @param accountID the UUID associated with the account to withdraw from. * @param amount Amount to withdraw. * @return {@link EconomyResponse} which includes the Economy plugin's * {@link ResponseType} as to whether the transaction was a Success, * Failure, Unsupported. */ @NotNull - EconomyResponse withdraw(String pluginName, UUID uuid, BigDecimal amount); + EconomyResponse withdraw(final String pluginName, final UUID accountID, final BigDecimal amount); /** * Withdraw an amount from an account associated with a UUID on a given world - @@ -321,7 +341,7 @@ public interface Economy { * does not support this the global balance will be returned. * * @param pluginName The name of the plugin that is calling the method. - * @param uuid the UUID associated with the account to withdraw from. + * @param accountID the UUID associated with the account to withdraw from. * @param worldName the name of the world to check in. * @param amount Amount to withdraw. * @return {@link EconomyResponse} which includes the Economy plugin's @@ -329,7 +349,7 @@ public interface Economy { * Failure, Unsupported. */ @NotNull - EconomyResponse withdraw(String pluginName, UUID uuid, String worldName, BigDecimal amount); + EconomyResponse withdraw(final String pluginName, final UUID accountID, final String worldName, final BigDecimal amount); /** * Withdraw an amount from an account associated with a UUID on a given world - @@ -337,7 +357,7 @@ public interface Economy { * does not support this the global balance will be returned. * * @param pluginName The name of the plugin that is calling the method. - * @param uuid the UUID associated with the account to withdraw from. + * @param accountID the UUID associated with the account to withdraw from. * @param worldName the name of the world to check in. * @param currency the currency to use. * @param amount Amount to withdraw. @@ -346,21 +366,21 @@ public interface Economy { * Failure, Unsupported. */ @NotNull - EconomyResponse withdraw(String pluginName, UUID uuid, String worldName, String currency, BigDecimal amount); + EconomyResponse withdraw(final String pluginName, final UUID accountID, final String worldName, final String currency, final BigDecimal amount); /** * Deposit an amount to an account associated with the given UUID - DO NOT USE * NEGATIVE AMOUNTS. * * @param pluginName The name of the plugin that is calling the method. - * @param uuid the UUID associated with the account to deposit to. + * @param accountID the UUID associated with the account to deposit to. * @param amount Amount to deposit. * @return {@link EconomyResponse} which includes the Economy plugin's * {@link ResponseType} as to whether the transaction was a Success, * Failure, Unsupported. */ @NotNull - EconomyResponse deposit(String pluginName, UUID uuid, BigDecimal amount); + EconomyResponse deposit(final String pluginName, final UUID accountID, final BigDecimal amount); /** * Deposit an amount to an account associated with a UUID on a given world - @@ -368,7 +388,7 @@ public interface Economy { * does not support this the global balance will be returned. * * @param pluginName The name of the plugin that is calling the method. - * @param uuid the UUID associated with the account to deposit to. + * @param accountID the {@link UUID} associated with the account to deposit to. * @param worldName the name of the world to check in. * @param amount Amount to deposit. * @return {@link EconomyResponse} which includes the Economy plugin's @@ -376,7 +396,7 @@ public interface Economy { * Failure, Unsupported. */ @NotNull - EconomyResponse deposit(String pluginName, UUID uuid, String worldName, BigDecimal amount); + EconomyResponse deposit(final String pluginName, final UUID accountID, final String worldName, final BigDecimal amount); /** * Deposit an amount to an account associated with a UUID on a given world - @@ -384,7 +404,7 @@ public interface Economy { * does not support this the global balance will be returned. * * @param pluginName The name of the plugin that is calling the method. - * @param uuid the UUID associated with the account to deposit to. + * @param accountID the {@link UUID} associated with the account to deposit to. * @param worldName the name of the world to check in. * @param currency the currency to use. * @param amount Amount to deposit. @@ -393,201 +413,105 @@ public interface Economy { * Failure, Unsupported. */ @NotNull - EconomyResponse deposit(String pluginName, UUID uuid, String worldName, String currency, BigDecimal amount); + EconomyResponse deposit(final String pluginName, final UUID accountID, final String worldName, final String currency, final BigDecimal amount); /* - * Bank methods follow. + * Shared Account Methods */ /** - * Creates a bank account with the specified name and the given UUID as the - * owner. + * Creates a shared account with the specified parameters. * - * @param pluginName The name of the plugin that is calling the method. - * @param name Name of account. - * @param uuid UUID of the account should be linked to. - * @return true if bank creation is successful. + * @param pluginName the name of the plugin + * @param accountID the {@link UUID} of the account + * @param name the name of the account + * @param owner the {@link UUID} of the account owner + * @return true if the shared account is successfully created, false otherwise */ - boolean createBank(String pluginName, String name, UUID uuid); + boolean createSharedAccount(final String pluginName, final UUID accountID, final String name, final UUID owner); /** - * Deletes a bank account with the specified UUID. + * Determines whether the specified owner ID is the owner of the account associated with the given account ID and plugin name. * - * @param pluginName The name of the plugin that is calling the method. - * @param uuid UUID of the bank to be deleted. - * @return true if the operation completed successfully + * @param pluginName the name of the plugin + * @param accountID the {@link UUID} of the account + * @param uuid the {@link UUID} to check for ownership of the account + * @return true if the owner ID is the owner of the account, false otherwise */ - boolean deleteBank(String pluginName, UUID uuid); + boolean isAccountOwner(final String pluginName, final UUID accountID, final UUID uuid); /** - * Returns a map that represents all the UUIDs which have banks 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. - */ - Map getBankUUIDNameMap(); - - /** - * Gets the last known name of an bank with the given UUID. Required for - * messages to be more human-readable than UUIDs alone can provide. - * - * @param uuid UUID to look up. - * @return name of the bank. - */ - @NotNull - String getBankAccountName(UUID uuid); - - /** - * Checks if this UUID has a bank yet. + * Sets the owner of a specified plugin to the given accountID. * - * @param uuid UUID to check. - * @return true if the UUID has an account. + * @param pluginName The name of the plugin. + * @param accountID The {@link UUID} of the account + * @param uuid The {@link UUID} of the account to set as the owner. + * @return true if the owner is successfully set, false otherwise. */ - boolean hasBankAccount(UUID uuid); + boolean setOwner(final String pluginName, final UUID accountID, final UUID uuid); /** - * Checks if the specified bank account supports the specified currency. + * Determines whether a specific member is an account member of a given plugin. * - * @param uuid UUID of the account. - * @param currency the currency to use. - * @return true if the bank supports the currency + * @param pluginName The name of the plugin. + * @param accountID The {@link UUID} of the account. + * @param uuid The {@link UUID} to check for membership. + * @return true if the member is an account member, false otherwise. */ - boolean bankSupportsCurrency(UUID uuid, String currency); + boolean isAccountMember(final String pluginName, final UUID accountID, final UUID uuid); /** - * A method which changes the name associated with the given UUID in the - * Map received from {@link #getBankUUIDNameMap()}. + * Adds a member to an account. * - * @param pluginName The name of the plugin that is calling the method. - * @param uuid UUID which is having a name change. - * @param name name that will be associated with the UUID in the - * Map map. - * @return true if the name change is successful. + * @param pluginName The name of the plugin. + * @param accountID The {@link UUID} of the account. + * @param uuid The {@link UUID} of the member to be added. + * @return true if the member was successfully added, false otherwise. */ - boolean renameBankAccount(String pluginName, UUID uuid, String name); + boolean addAccountMember(final String pluginName, final UUID accountID, final UUID uuid); /** - * Returns the amount the bank has. + * Adds a member to an account with the specified initial permissions. * - * @param pluginName The name of the plugin that is calling the method. - * @param uuid UUID of the account. - * @return amount which the bank holds as a balance. + * @param pluginName The name of the plugin. + * @param accountID The {@link UUID} of the account. + * @param uuid The {@link UUID} of the member to be added. + * @param initialPermissions The initial permissions to be assigned to the member. The values for + * these should be assumed to be "true." + * @return true if the member was added successfully, false otherwise. */ - @NotNull - BigDecimal bankBalance(String pluginName, UUID uuid); + boolean addAccountMember(final String pluginName, final UUID accountID, final UUID uuid, final AccountPermission... initialPermissions); /** - * Returns the amount the bank has. + * Removes a member from an account. * - * @param pluginName The name of the plugin that is calling the method. - * @param uuid UUID of the account. - * @param currency the currency to use. - * @return amount which the bank holds as a balance. + * @param pluginName the name of the plugin managing the account + * @param accountID the {@link UUID} of the account + * @param uuid the {@link UUID} of the member to be removed + * @return true if the member was successfully removed, false otherwise */ - @NotNull - BigDecimal bankBalance(String pluginName, UUID uuid, String currency); + boolean removeAccountMember(final String pluginName, final UUID accountID, final UUID uuid); /** - * Returns true or false whether the bank has the amount specified - DO NOT USE - * NEGATIVE AMOUNTS. + * Checks if the specified account has the given permission for the given plugin. * - * @param pluginName The name of the plugin that is calling the method. - * @param uuid UUID of the account. - * @param amount to check for - * @return true if the bank has the given amount. + * @param pluginName the name of the plugin to check permission for + * @param accountID the {@link UUID} of the account + * @param uuid the {@link UUID} to check for the permission + * @param permission the permission to check for + * @return true if the account has the specified permission, false otherwise */ - boolean bankHas(String pluginName, UUID uuid, BigDecimal amount); + boolean hasAccountPermission(final String pluginName, final UUID accountID, final UUID uuid, final AccountPermission permission); /** - * Returns true or false whether the bank has the amount specified - DO NOT USE - * NEGATIVE AMOUNTS. + * Updates the account permission for a specific plugin and user. * - * @param pluginName The name of the plugin that is calling the method. - * @param uuid UUID of the account. - * @param currency the currency to use. - * @param amount to check for - * @return true if the bank has the given amount. - */ - boolean bankHas(String pluginName, UUID uuid, String currency, BigDecimal amount); - - /** - * Withdraw an amount from a bank account - DO NOT USE NEGATIVE AMOUNTS. - * - * @param pluginName The name of the plugin that is calling the method. - * @param uuid UUID of the account. - * @param amount to withdraw. - * @return {@link EconomyResponse} which includes the Economy plugin's - * {@link ResponseType} as to whether the transaction was a Success, - * Failure, Unsupported. - */ - @NotNull - EconomyResponse bankWithdraw(String pluginName, UUID uuid, BigDecimal amount); - - /** - * Withdraw an amount from a bank account - DO NOT USE NEGATIVE AMOUNTS. - * - * @param pluginName The name of the plugin that is calling the method. - * @param uuid UUID of the account. - * @param currency the currency to use. - * @param amount to withdraw. - * @return {@link EconomyResponse} which includes the Economy plugin's - * {@link ResponseType} as to whether the transaction was a Success, - * Failure, Unsupported. - */ - @NotNull - EconomyResponse bankWithdraw(String pluginName, UUID uuid, String currency, BigDecimal amount); - - /** - * Deposit an amount into a bank account - DO NOT USE NEGATIVE AMOUNTS. - * - * @param pluginName The name of the plugin that is calling the method. - * @param uuid UUID of the account. - * @param amount to deposit. - * @return {@link EconomyResponse} which includes the Economy plugin's - * {@link ResponseType} as to whether the transaction was a Success, - * Failure, Unsupported. - */ - @NotNull - EconomyResponse bankDeposit(String pluginName, UUID uuid, BigDecimal amount); - - /** - * Deposit an amount into a bank account - DO NOT USE NEGATIVE AMOUNTS. - * - * @param pluginName The name of the plugin that is calling the method. - * @param uuid UUID of the account. - * @param currency the currency to use. - * @param amount to deposit. - * @return {@link EconomyResponse} which includes the Economy plugin's - * {@link ResponseType} as to whether the transaction was a Success, - * Failure, Unsupported. - */ - @NotNull - EconomyResponse bankDeposit(String pluginName, UUID uuid, String currency, BigDecimal amount); - - /** - * Check if a UUID is the owner of a bank account. - * - * @param uuid UUID of the player/object who might be an owner. - * @param bankUUID UUID of the bank account to check ownership of. - * @return true if the uuid is the owner of the bank associated with bankUUID. - */ - boolean isBankOwner(UUID uuid, UUID bankUUID); - - /** - * Check if the UUID is a member of the bank account - * - * @param uuid UUID of the player/object who might be a member. - * @param bankUUID UUID of the bank account to check membership of. - * @return @return true if the uuid is a member of the bank associated with bankUUID. - */ - boolean isBankMember(UUID uuid, UUID bankUUID); - - /** - * Gets the list of banks' UUIDs. - * - * @return the List of Banks' UUIDs. + * @param pluginName the name of the plugin + * @param accountID the {@link UUID} of the account + * @param uuid the {@link UUID} to update the permission for + * @param permission the new account permissions to set + * @param value the new permission value to set for this value + * @return true if the account permission was successfully updated, false otherwise */ - Collection getBanks(); -} + boolean updateAccountPermission(final String pluginName, final UUID accountID, final UUID uuid, final AccountPermission permission, final boolean value); +} \ No newline at end of file From ff7904525bb9229795d13936be40c6d5d814ff89 Mon Sep 17 00:00:00 2001 From: Fedjoyd <53665065+Fedjoyd@users.noreply.github.com> Date: Sun, 6 Oct 2024 07:51:13 +0200 Subject: [PATCH 34/95] Added "String pluginName" parameter to display function I added the "String pluginName" parameter to the function: fractionalDigits, format, getDefaultCurrency, defaultCurrencyNamePlural and defaultCurrencyNameSingular for the creation of an economy plugin that redirects the calls of these functions to different currencies depending on the plugin that calls them (for example in my multi-currency economy plugin I created a possibility to define a currency on a plugin the modifications I made allow these plugins to display the amounts in the right currency (in case the calling plugin does not support multi-currency)) --- .../net/milkbowl/vault2/economy/Economy.java | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/main/java/net/milkbowl/vault2/economy/Economy.java b/src/main/java/net/milkbowl/vault2/economy/Economy.java index 24e07b7..d5fce03 100644 --- a/src/main/java/net/milkbowl/vault2/economy/Economy.java +++ b/src/main/java/net/milkbowl/vault2/economy/Economy.java @@ -73,34 +73,37 @@ public interface Economy { * function returns the number of digits the plugin keeps or -1 if no rounding * occurs. * + * @param pluginName The name of the plugin that is calling the method. * @return number of digits after the decimal point this plugin supports or -1 * if no rounding occurs. */ @NotNull - int fractionalDigits(); + int fractionalDigits(final String pluginName); /** * Plugins use this method to format a given BigDecimal amount into a human-readable * amount using your economy plugin's currency names/conventions. * + * @param pluginName The name of the plugin that is calling the method. * @param amount to format. * * @return Human-readable string describing amount, ie 5 Dollars or 5.55 Pounds. */ @NotNull - String format(BigDecimal amount); + String format(final String pluginName, BigDecimal amount); /** * Plugins use this method to format a given BigDecimal amount into a human-readable * amount using your economy plugin's currency names/conventions. * + * @param pluginName The name of the plugin that is calling the method. * @param amount to format. * @param currency the currency to use for the format. * * @return Human-readable string describing amount, ie 5 Dollars or 5.55 Pounds. */ @NotNull - String format(BigDecimal amount, final String currency); + String format(final String pluginName, BigDecimal amount, final String currency); /** * Returns true if a currency with the specified name exists. @@ -114,30 +117,34 @@ public interface Economy { /** * Used to get the default currency. This could be the default currency for the server globally or * for the default world if the implementation supports multi-world. + * + * @param pluginName The name of the plugin that is calling the method. * @return The currency that is the default for the server if multi-world support is not available * otherwise the default for the default world. * */ @NotNull - String getDefaultCurrency(); + String getDefaultCurrency(final String pluginName); /** * Returns the name of the default currency in plural form. If the economy being used * does not support currency names then an empty string will be returned. * + * @param pluginName The name of the plugin that is calling the method. * @return name of the currency (plural) ie: Dollars or Pounds. */ @NotNull - String defaultCurrencyNamePlural(); + String defaultCurrencyNamePlural(final String pluginName); /** * Returns the name of the default currency in singular form. If the economy being used * does not support currency names then an empty string will be returned. * + * @param pluginName The name of the plugin that is calling the method. * @return name of the currency (singular) ie: Dollar or Pound. */ @NotNull - String defaultCurrencyNameSingular(); + String defaultCurrencyNameSingular(final String pluginName); /** * Returns a list of currencies used by the economy plugin. These are able to be used @@ -514,4 +521,4 @@ public interface Economy { * @return true if the account permission was successfully updated, false otherwise */ boolean updateAccountPermission(final String pluginName, final UUID accountID, final UUID uuid, final AccountPermission permission, final boolean value); -} \ No newline at end of file +} From c6c69d667b7f85b7d84fee5c3ff08376c7d9c4f0 Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Sun, 6 Oct 2024 18:34:24 -0400 Subject: [PATCH 35/95] Update maven.yml --- .github/workflows/maven.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index f5abe21..9896c86 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -15,13 +15,13 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up JDK 1.8 - uses: actions/setup-java@v1 + uses: actions/setup-java@v3 with: java-version: 1.8 - name: Cache Maven packages - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: ~/.m2 key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} @@ -32,7 +32,7 @@ jobs: run: mvn -B javadoc:jar --file pom.xml - name: Stage the artifact run: mkdir staging && cp target/*.jar staging - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 with: name: VaultUnlockedAPI path: staging From f781fc9756c628bb8cf04f8f1b0d2261d987e372 Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Sun, 6 Oct 2024 18:37:13 -0400 Subject: [PATCH 36/95] Update maven.yml --- .github/workflows/maven.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 9896c86..dfdafab 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -20,6 +20,7 @@ jobs: uses: actions/setup-java@v3 with: java-version: 1.8 + distribution: 'temurin' - name: Cache Maven packages uses: actions/cache@v4 with: From b5e6492e1fcb451030b3c9a685886d69dc624c0f Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Sun, 6 Oct 2024 19:07:02 -0400 Subject: [PATCH 37/95] Update maven.yml --- .github/workflows/maven.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index dfdafab..541c027 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -19,7 +19,7 @@ jobs: - name: Set up JDK 1.8 uses: actions/setup-java@v3 with: - java-version: 1.8 + java-version: '8' distribution: 'temurin' - name: Cache Maven packages uses: actions/cache@v4 From 85f828896265e8cd6287a25b717b146286afae45 Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Sun, 6 Oct 2024 19:09:01 -0400 Subject: [PATCH 38/95] Update maven.yml --- .github/workflows/maven.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 541c027..95111fb 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -29,8 +29,8 @@ jobs: restore-keys: ${{ runner.os }}-m2 - name: Build Release run: mvn -B package --file pom.xml - - name: Build javadoc - run: mvn -B javadoc:jar --file pom.xml + #- name: Build javadoc + # run: mvn -B javadoc:jar --file pom.xml - name: Stage the artifact run: mkdir staging && cp target/*.jar staging - uses: actions/upload-artifact@v3 From 69b46bf05cbbbdab4a077f5088033fbe4173892c Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Sun, 6 Oct 2024 19:54:46 -0400 Subject: [PATCH 39/95] Update Version, Add Component for format methods, add deprecation. --- pom.xml | 8 ++++- .../net/milkbowl/vault2/economy/Economy.java | 32 +++++++++++++++++-- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 0ebc17e..e4fedb3 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 net.milkbowl.vault VaultUnlockedAPI - 2.5 + 2.6 VaultUnlockedAPI @@ -89,6 +89,12 @@ 24.0.0 compile + + net.kyori + adventure-text-minimessage + 4.17.0 + provided + diff --git a/src/main/java/net/milkbowl/vault2/economy/Economy.java b/src/main/java/net/milkbowl/vault2/economy/Economy.java index d5fce03..6e4c5e9 100644 --- a/src/main/java/net/milkbowl/vault2/economy/Economy.java +++ b/src/main/java/net/milkbowl/vault2/economy/Economy.java @@ -16,6 +16,7 @@ package net.milkbowl.vault2.economy; +import net.kyori.adventure.text.Component; import net.milkbowl.vault2.economy.EconomyResponse.ResponseType; import org.jetbrains.annotations.NotNull; @@ -84,13 +85,13 @@ public interface Economy { * Plugins use this method to format a given BigDecimal amount into a human-readable * amount using your economy plugin's currency names/conventions. * - * @param pluginName The name of the plugin that is calling the method. * @param amount to format. * * @return Human-readable string describing amount, ie 5 Dollars or 5.55 Pounds. + * @deprecated Use {@link #format(String, BigDecimal)} instead. */ @NotNull - String format(final String pluginName, BigDecimal amount); + String format(BigDecimal amount); /** * Plugins use this method to format a given BigDecimal amount into a human-readable @@ -98,12 +99,37 @@ public interface Economy { * * @param pluginName The name of the plugin that is calling the method. * @param amount to format. + * + * @return Human-readable {@link Component text component} describing amount, ie 5 Dollars or 5.55 Pounds. + */ + @NotNull + Component format(final String pluginName, BigDecimal amount); + + /** + * Plugins use this method to format a given BigDecimal amount into a human-readable + * amount using your economy plugin's currency names/conventions. + * + * @param amount to format. * @param currency the currency to use for the format. * * @return Human-readable string describing amount, ie 5 Dollars or 5.55 Pounds. + * @deprecated Use {@link #format(String, BigDecimal, String)} instead. + */ + @NotNull + String format(BigDecimal amount, final String currency); + + /** + * Plugins use this method to format a given BigDecimal amount into a human-readable + * amount using your economy plugin's currency names/conventions. + * + * @param pluginName The name of the plugin that is calling the method. + * @param amount to format. + * @param currency the currency to use for the format. + * + * @return Human-readable {@link Component text component} describing amount, ie 5 Dollars or 5.55 Pounds. */ @NotNull - String format(final String pluginName, BigDecimal amount, final String currency); + Component format(final String pluginName, BigDecimal amount, final String currency); /** * Returns true if a currency with the specified name exists. From a6107cb993adea8f797c29f9b8058c8441feef7a Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Fri, 11 Oct 2024 18:25:17 -0400 Subject: [PATCH 40/95] Add parameters config to the compiler configs. --- pom.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pom.xml b/pom.xml index e4fedb3..08b75d5 100644 --- a/pom.xml +++ b/pom.xml @@ -107,6 +107,9 @@ 8 8 + + -parameters + From ebdabeb190daf125e1f7427c882a57baef6c3666 Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Wed, 23 Oct 2024 17:32:42 -0400 Subject: [PATCH 41/95] Bump to 2.7, remove Component requirement. --- pom.xml | 8 +------- .../java/net/milkbowl/vault2/economy/Economy.java | 11 ++++++----- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/pom.xml b/pom.xml index 08b75d5..4aa7318 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 net.milkbowl.vault VaultUnlockedAPI - 2.6 + 2.7 VaultUnlockedAPI @@ -89,12 +89,6 @@ 24.0.0 compile - - net.kyori - adventure-text-minimessage - 4.17.0 - provided - diff --git a/src/main/java/net/milkbowl/vault2/economy/Economy.java b/src/main/java/net/milkbowl/vault2/economy/Economy.java index 6e4c5e9..dbdf114 100644 --- a/src/main/java/net/milkbowl/vault2/economy/Economy.java +++ b/src/main/java/net/milkbowl/vault2/economy/Economy.java @@ -16,7 +16,6 @@ package net.milkbowl.vault2.economy; -import net.kyori.adventure.text.Component; import net.milkbowl.vault2.economy.EconomyResponse.ResponseType; import org.jetbrains.annotations.NotNull; @@ -91,6 +90,7 @@ public interface Economy { * @deprecated Use {@link #format(String, BigDecimal)} instead. */ @NotNull + @Deprecated String format(BigDecimal amount); /** @@ -100,10 +100,10 @@ public interface Economy { * @param pluginName The name of the plugin that is calling the method. * @param amount to format. * - * @return Human-readable {@link Component text component} describing amount, ie 5 Dollars or 5.55 Pounds. + * @return Human-readable String describing amount, ie 5 Dollars or 5.55 Pounds. */ @NotNull - Component format(final String pluginName, BigDecimal amount); + String format(final String pluginName, BigDecimal amount); /** * Plugins use this method to format a given BigDecimal amount into a human-readable @@ -116,6 +116,7 @@ public interface Economy { * @deprecated Use {@link #format(String, BigDecimal, String)} instead. */ @NotNull + @Deprecated String format(BigDecimal amount, final String currency); /** @@ -126,10 +127,10 @@ public interface Economy { * @param amount to format. * @param currency the currency to use for the format. * - * @return Human-readable {@link Component text component} describing amount, ie 5 Dollars or 5.55 Pounds. + * @return Human-readable String describing amount, ie 5 Dollars or 5.55 Pounds. */ @NotNull - Component format(final String pluginName, BigDecimal amount, final String currency); + String format(final String pluginName, BigDecimal amount, final String currency); /** * Returns true if a currency with the specified name exists. From fc0f108972be6e825c2b00c8308ac5fece232fc5 Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Wed, 23 Oct 2024 17:37:17 -0400 Subject: [PATCH 42/95] Update license header to LGPL for AccountPermission. --- .../vault2/economy/AccountPermission.java | 33 +++++++++---------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/src/main/java/net/milkbowl/vault2/economy/AccountPermission.java b/src/main/java/net/milkbowl/vault2/economy/AccountPermission.java index b604263..18668b2 100644 --- a/src/main/java/net/milkbowl/vault2/economy/AccountPermission.java +++ b/src/main/java/net/milkbowl/vault2/economy/AccountPermission.java @@ -1,27 +1,26 @@ package net.milkbowl.vault2.economy; -/* - * The New Kings - * Copyright (C) 2022 - 2024 Daniel "creatorfromhell" Vidmar - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + +/* 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 . */ /** * AccountPermission * * @author creatorfromhell - * @since 0.0.1.0 + * @since 2.7 */ public enum AccountPermission { From 6579ca3f9630a43ba6c94b6d5a48f6d878e39882 Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Wed, 23 Oct 2024 17:51:53 -0400 Subject: [PATCH 43/95] Add deleteAccount method, and update parameters to be final for consistency. --- .../net/milkbowl/vault2/economy/Economy.java | 40 ++++++++++++++----- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/src/main/java/net/milkbowl/vault2/economy/Economy.java b/src/main/java/net/milkbowl/vault2/economy/Economy.java index dbdf114..14185ff 100644 --- a/src/main/java/net/milkbowl/vault2/economy/Economy.java +++ b/src/main/java/net/milkbowl/vault2/economy/Economy.java @@ -91,7 +91,7 @@ public interface Economy { */ @NotNull @Deprecated - String format(BigDecimal amount); + String format(final BigDecimal amount); /** * Plugins use this method to format a given BigDecimal amount into a human-readable @@ -103,7 +103,7 @@ public interface Economy { * @return Human-readable String describing amount, ie 5 Dollars or 5.55 Pounds. */ @NotNull - String format(final String pluginName, BigDecimal amount); + String format(final String pluginName, final BigDecimal amount); /** * Plugins use this method to format a given BigDecimal amount into a human-readable @@ -117,7 +117,7 @@ public interface Economy { */ @NotNull @Deprecated - String format(BigDecimal amount, final String currency); + String format(final BigDecimal amount, final String currency); /** * Plugins use this method to format a given BigDecimal amount into a human-readable @@ -130,7 +130,7 @@ public interface Economy { * @return Human-readable String describing amount, ie 5 Dollars or 5.55 Pounds. */ @NotNull - String format(final String pluginName, BigDecimal amount, final String currency); + String format(final String pluginName, final BigDecimal amount, final String currency); /** * Returns true if a currency with the specified name exists. @@ -193,7 +193,7 @@ public interface Economy { * @param name UUID associated with the account. * @return true if the account creation was successful. */ - boolean createAccount(UUID accountID, final String name); + boolean createAccount(final UUID accountID, final String name); /** * Attempts to create an account for the given UUID on the specified world @@ -205,7 +205,7 @@ public interface Economy { * @param worldName String name of the world. * @return if the account creation was successful */ - boolean createAccount(UUID accountID, final String name, final String worldName); + boolean createAccount(final UUID accountID, final String name, final String worldName); /** * Returns a map that represents all the UUIDs which have accounts in the @@ -225,7 +225,7 @@ public interface Economy { * @return An optional containing the last known name if the account exists, otherwise an empty * optional. */ - Optional getAccountName(UUID accountID); + Optional getAccountName(final UUID accountID); /** * Checks if this UUID has an account yet. @@ -233,7 +233,7 @@ public interface Economy { * @param accountID UUID to check for an existing account. * @return true if the UUID has an account. */ - boolean hasAccount(UUID accountID); + boolean hasAccount(final UUID accountID); /** * Checks if this UUID has an account yet on the given world. @@ -242,7 +242,7 @@ public interface Economy { * @param worldName world-specific account. * @return if the UUID has an account. */ - boolean hasAccount(UUID accountID, final String worldName); + boolean hasAccount(final UUID accountID, final String worldName); /** * A method which changes the name associated with the given UUID in the @@ -253,7 +253,27 @@ public interface Economy { * Map map. * @return true if the name change is successful. */ - boolean renameAccount(UUID accountID, final String name); + boolean renameAccount(final UUID accountID, final String name); + + /** + * Renames the account with the specified ID in the given plugin to the new name. + * + * @param plugin The plugin name where the account exists + * @param accountID The unique identifier of the account to be renamed + * @param name The new name to assign to the account + * + * @return true if the rename operation was successful, false otherwise + */ + boolean renameAccount(final String plugin, final UUID accountID, final String name); + + /** + * Deletes the account associated with the specified UUID. + * + * @param plugin the name of the plugin managing the account + * @param accountID the UUID of the account to be deleted + * @return true if the account was successfully deleted, false otherwise + */ + boolean deleteAccount(final String plugin, final UUID accountID); /* * Account balance related methods follow. From 5725fb027da003677a5f7a2df1daaf50ac7e811c Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Tue, 17 Dec 2024 20:13:53 -0500 Subject: [PATCH 44/95] Add new createAccount methods with parameter to indicate if player account or not. --- .../net/milkbowl/vault2/economy/Economy.java | 25 ++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/milkbowl/vault2/economy/Economy.java b/src/main/java/net/milkbowl/vault2/economy/Economy.java index 14185ff..0b88114 100644 --- a/src/main/java/net/milkbowl/vault2/economy/Economy.java +++ b/src/main/java/net/milkbowl/vault2/economy/Economy.java @@ -187,7 +187,7 @@ public interface Economy { */ /** - * Attempts to create a account for the given UUID. + * Attempts to create an account for the given UUID. * * @param accountID UUID associated with the account. * @param name UUID associated with the account. @@ -195,6 +195,17 @@ public interface Economy { */ boolean createAccount(final UUID accountID, final String name); + /** + * Creates a new account with the provided information. + * + * @param accountID The UUID of the account to be created. + * @param name The name associated with the account. + * @param player A flag indicating if the account is a player account. + * + * @return true if the account was successfully created, false otherwise. + */ + boolean createAccount(final UUID accountID, final String name, final boolean player); + /** * Attempts to create an account for the given UUID on the specified world * IMPLEMENTATION SPECIFIC - if an economy plugin does not support this then @@ -207,6 +218,18 @@ public interface Economy { */ boolean createAccount(final UUID accountID, final String name, final String worldName); + /** + * Creates a new account with the given parameters. + * + * @param accountID The UUID of the account to be created. + * @param name The name of the account holder. + * @param worldName The world name associated with the account. + * @param player A boolean indicating if the account belongs to a player. + * + * @return True if the account was successfully created, false otherwise. + */ + boolean createAccount(final UUID accountID, final String name, final String worldName, final boolean player); + /** * Returns a map that represents all the UUIDs which have accounts in the * plugin, as well as their last-known-name. This is used for Vault's economy From 1eb37ed08d6abbd3bf19264ac460bf840763dd08 Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Fri, 20 Dec 2024 12:38:02 -0500 Subject: [PATCH 45/95] Add deprecations to old createAccount Methods, and update version --- pom.xml | 2 +- src/main/java/net/milkbowl/vault2/economy/Economy.java | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 4aa7318..ec50c2c 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 net.milkbowl.vault VaultUnlockedAPI - 2.7 + 2.8 VaultUnlockedAPI diff --git a/src/main/java/net/milkbowl/vault2/economy/Economy.java b/src/main/java/net/milkbowl/vault2/economy/Economy.java index 0b88114..7710e07 100644 --- a/src/main/java/net/milkbowl/vault2/economy/Economy.java +++ b/src/main/java/net/milkbowl/vault2/economy/Economy.java @@ -188,6 +188,9 @@ public interface Economy { /** * Attempts to create an account for the given UUID. + * + * @deprecated This method is deprecated, and has been replaced by {@link #createAccount(UUID, String, String, boolean)}. + * This allows economy plugins to know exactly if the account is a player or not. This will be removed after 3 releases. * * @param accountID UUID associated with the account. * @param name UUID associated with the account. @@ -210,6 +213,9 @@ public interface Economy { * 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. + * + * @deprecated This method is deprecated, and has been replaced by {@link #createAccount(UUID, String, String, boolean)}. + * This allows economy plugins to know exactly if the account is a player or not. This will be removed after 3 releases. * * @param accountID UUID associated with the account. * @param name UUID associated with the account. From 537ef58fffd1f584895fcc7250800320e54367fa Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Sat, 28 Dec 2024 15:22:23 -0500 Subject: [PATCH 46/95] Add annotations to Economy API classes. --- README.md | 3 + pom.xml | 2 +- .../net/milkbowl/vault2/economy/Economy.java | 90 ++++++++++--------- .../vault2/economy/EconomyResponse.java | 6 +- 4 files changed, 54 insertions(+), 47 deletions(-) diff --git a/README.md b/README.md index 366f881..f4c821d 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,9 @@ along with Vault. If not, see . ## Building VaultUnlockedAPI comes with all libraries needed to build from the current branch. +## Plugin Support +While VaultUnlocked works with plugins that support the original Vault, + ## Implementing VaultUnlocked Implementing VaultUnlocked is quite simple. It requires getting the Economy, Permission, or Chat service from the Bukkit ServiceManager. See the example below: diff --git a/pom.xml b/pom.xml index ec50c2c..df8087f 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 net.milkbowl.vault VaultUnlockedAPI - 2.8 + 2.9 VaultUnlockedAPI diff --git a/src/main/java/net/milkbowl/vault2/economy/Economy.java b/src/main/java/net/milkbowl/vault2/economy/Economy.java index 7710e07..ccb118d 100644 --- a/src/main/java/net/milkbowl/vault2/economy/Economy.java +++ b/src/main/java/net/milkbowl/vault2/economy/Economy.java @@ -78,7 +78,7 @@ public interface Economy { * if no rounding occurs. */ @NotNull - int fractionalDigits(final String pluginName); + int fractionalDigits(@NotNull final String pluginName); /** * Plugins use this method to format a given BigDecimal amount into a human-readable @@ -91,7 +91,7 @@ public interface Economy { */ @NotNull @Deprecated - String format(final BigDecimal amount); + String format(@NotNull final BigDecimal amount); /** * Plugins use this method to format a given BigDecimal amount into a human-readable @@ -103,7 +103,7 @@ public interface Economy { * @return Human-readable String describing amount, ie 5 Dollars or 5.55 Pounds. */ @NotNull - String format(final String pluginName, final BigDecimal amount); + String format(@NotNull final String pluginName, @NotNull final BigDecimal amount); /** * Plugins use this method to format a given BigDecimal amount into a human-readable @@ -117,7 +117,7 @@ public interface Economy { */ @NotNull @Deprecated - String format(final BigDecimal amount, final String currency); + String format(@NotNull final BigDecimal amount, @NotNull final String currency); /** * Plugins use this method to format a given BigDecimal amount into a human-readable @@ -130,7 +130,7 @@ public interface Economy { * @return Human-readable String describing amount, ie 5 Dollars or 5.55 Pounds. */ @NotNull - String format(final String pluginName, final BigDecimal amount, final String currency); + String format(@NotNull final String pluginName, @NotNull final BigDecimal amount, @NotNull final String currency); /** * Returns true if a currency with the specified name exists. @@ -139,7 +139,7 @@ public interface Economy { * * @return true if a currency with the specified name exists. */ - boolean hasCurrency(final String currency); + boolean hasCurrency(@NotNull final String currency); /** * Used to get the default currency. This could be the default currency for the server globally or @@ -151,7 +151,7 @@ public interface Economy { * */ @NotNull - String getDefaultCurrency(final String pluginName); + String getDefaultCurrency(@NotNull final String pluginName); /** * Returns the name of the default currency in plural form. If the economy being used @@ -161,7 +161,7 @@ public interface Economy { * @return name of the currency (plural) ie: Dollars or Pounds. */ @NotNull - String defaultCurrencyNamePlural(final String pluginName); + String defaultCurrencyNamePlural(@NotNull final String pluginName); /** * Returns the name of the default currency in singular form. If the economy being used @@ -171,7 +171,7 @@ public interface Economy { * @return name of the currency (singular) ie: Dollar or Pound. */ @NotNull - String defaultCurrencyNameSingular(final String pluginName); + String defaultCurrencyNameSingular(@NotNull final String pluginName); /** * Returns a list of currencies used by the economy plugin. These are able to be used @@ -180,6 +180,7 @@ public interface Economy { * @return list of currencies used by the economy plugin. These are able to be used * in the calls in the methods of the API. */ + @NotNull Collection currencies(); /* @@ -196,7 +197,7 @@ public interface Economy { * @param name UUID associated with the account. * @return true if the account creation was successful. */ - boolean createAccount(final UUID accountID, final String name); + boolean createAccount(@NotNull final UUID accountID, @NotNull final String name); /** * Creates a new account with the provided information. @@ -207,7 +208,7 @@ public interface Economy { * * @return true if the account was successfully created, false otherwise. */ - boolean createAccount(final UUID accountID, final String name, final boolean player); + boolean createAccount(@NotNull final UUID accountID, @NotNull final String name, final boolean player); /** * Attempts to create an account for the given UUID on the specified world @@ -222,7 +223,7 @@ public interface Economy { * @param worldName String name of the world. * @return if the account creation was successful */ - boolean createAccount(final UUID accountID, final String name, final String worldName); + boolean createAccount(@NotNull final UUID accountID, @NotNull final String name, @NotNull final String worldName); /** * Creates a new account with the given parameters. @@ -234,7 +235,7 @@ public interface Economy { * * @return True if the account was successfully created, false otherwise. */ - boolean createAccount(final UUID accountID, final String name, final String worldName, final boolean player); + boolean createAccount(@NotNull final UUID accountID, @NotNull final String name, @NotNull final String worldName, final boolean player); /** * Returns a map that represents all the UUIDs which have accounts in the @@ -244,6 +245,7 @@ public interface Economy { * @return a {@link Map} composed of the accounts keyed by their UUID, along * with their associated last-known-name. */ + @NotNull Map getUUIDNameMap(); /** @@ -254,7 +256,7 @@ public interface Economy { * @return An optional containing the last known name if the account exists, otherwise an empty * optional. */ - Optional getAccountName(final UUID accountID); + Optional getAccountName(@NotNull final UUID accountID); /** * Checks if this UUID has an account yet. @@ -262,7 +264,7 @@ public interface Economy { * @param accountID UUID to check for an existing account. * @return true if the UUID has an account. */ - boolean hasAccount(final UUID accountID); + boolean hasAccount(@NotNull final UUID accountID); /** * Checks if this UUID has an account yet on the given world. @@ -271,18 +273,18 @@ public interface Economy { * @param worldName world-specific account. * @return if the UUID has an account. */ - boolean hasAccount(final UUID accountID, final String worldName); + boolean hasAccount(@NotNull final UUID accountID, @NotNull final String worldName); /** * A method which changes the name associated with the given UUID in the - * Map received from {@link #getUUIDNameMap()}. + * Map received from {@link #getUUIDNameMap()}. * * @param accountID UUID whose account is having a name change. * @param name String name that will be associated with the UUID in the - * Map map. + * Map map. * @return true if the name change is successful. */ - boolean renameAccount(final UUID accountID, final String name); + boolean renameAccount(@NotNull final UUID accountID, @NotNull final String name); /** * Renames the account with the specified ID in the given plugin to the new name. @@ -293,7 +295,7 @@ public interface Economy { * * @return true if the rename operation was successful, false otherwise */ - boolean renameAccount(final String plugin, final UUID accountID, final String name); + boolean renameAccount(@NotNull final String plugin, @NotNull final UUID accountID, @NotNull final String name); /** * Deletes the account associated with the specified UUID. @@ -302,7 +304,7 @@ public interface Economy { * @param accountID the UUID of the account to be deleted * @return true if the account was successfully deleted, false otherwise */ - boolean deleteAccount(final String plugin, final UUID accountID); + boolean deleteAccount(@NotNull final String plugin, @NotNull final UUID accountID); /* * Account balance related methods follow. @@ -316,7 +318,7 @@ public interface Economy { * @param currency the currency to check support for * @return true if the account supports the currency, false otherwise */ - boolean accountSupportsCurrency(final String plugin, final UUID accountID, final String currency); + boolean accountSupportsCurrency(@NotNull final String plugin, @NotNull final UUID accountID, @NotNull final String currency); /** * Checks if the given account supports the specified currency in the given world. @@ -327,7 +329,7 @@ public interface Economy { * @param world the name of the world to check in * @return true if the account supports the currency in the world, false otherwise */ - boolean accountSupportsCurrency(final String plugin, final UUID accountID, final String currency, final String world); + boolean accountSupportsCurrency(@NotNull final String plugin, @NotNull final UUID accountID, @NotNull final String currency, @NotNull final String world); /** * Gets balance of an account associated with a UUID. @@ -337,7 +339,7 @@ public interface Economy { * @return Amount currently held in account associated with the given UUID. */ @NotNull - BigDecimal getBalance(final String pluginName, final UUID accountID); + BigDecimal getBalance(@NotNull final String pluginName, @NotNull final UUID accountID); /** * Gets balance of a UUID on the specified world. IMPLEMENTATION SPECIFIC - if @@ -349,7 +351,7 @@ public interface Economy { * @return Amount currently held in account associated with the given UUID. */ @NotNull - BigDecimal getBalance(final String pluginName, final UUID accountID, final String world); + BigDecimal getBalance(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final String world); /** * Gets balance of a UUID on the specified world. IMPLEMENTATION SPECIFIC - if @@ -362,7 +364,7 @@ public interface Economy { * @return Amount currently held in account associated with the given UUID. */ @NotNull - BigDecimal getBalance(final String pluginName, final UUID accountID, final String world, final String currency); + BigDecimal getBalance(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final String world, @NotNull final String currency); /** * Checks if the account associated with the given UUID has the amount - DO NOT @@ -373,7 +375,7 @@ public interface Economy { * @param amount the amount to check for. * @return True if UUID has amount, False else wise. */ - boolean has(final String pluginName, final UUID accountID, final BigDecimal amount); + boolean has(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final BigDecimal amount); /** * Checks if the account associated with the given UUID has the amount in the @@ -387,7 +389,7 @@ public interface Economy { * @return True if UUID has amount in the given world, * False else wise. */ - boolean has(final String pluginName, final UUID accountID, final String worldName, final BigDecimal amount); + boolean has(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final String worldName, @NotNull final BigDecimal amount); /** * Checks if the account associated with the given UUID has the amount in the @@ -402,7 +404,7 @@ public interface Economy { * @return True if UUID has amount in the given world, * False else wise. */ - boolean has(final String pluginName, final UUID accountID, final String worldName, final String currency, final BigDecimal amount); + boolean has(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final String worldName, @NotNull final String currency, @NotNull final BigDecimal amount); /** * Withdraw an amount from an account associated with a UUID - DO NOT USE @@ -416,7 +418,7 @@ public interface Economy { * Failure, Unsupported. */ @NotNull - EconomyResponse withdraw(final String pluginName, final UUID accountID, final BigDecimal amount); + EconomyResponse withdraw(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final BigDecimal amount); /** * Withdraw an amount from an account associated with a UUID on a given world - @@ -432,7 +434,7 @@ public interface Economy { * Failure, Unsupported. */ @NotNull - EconomyResponse withdraw(final String pluginName, final UUID accountID, final String worldName, final BigDecimal amount); + EconomyResponse withdraw(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final String worldName, @NotNull final BigDecimal amount); /** * Withdraw an amount from an account associated with a UUID on a given world - @@ -449,7 +451,7 @@ public interface Economy { * Failure, Unsupported. */ @NotNull - EconomyResponse withdraw(final String pluginName, final UUID accountID, final String worldName, final String currency, final BigDecimal amount); + EconomyResponse withdraw(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final String worldName, @NotNull final String currency, @NotNull final BigDecimal amount); /** * Deposit an amount to an account associated with the given UUID - DO NOT USE @@ -463,7 +465,7 @@ public interface Economy { * Failure, Unsupported. */ @NotNull - EconomyResponse deposit(final String pluginName, final UUID accountID, final BigDecimal amount); + EconomyResponse deposit(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final BigDecimal amount); /** * Deposit an amount to an account associated with a UUID on a given world - @@ -479,7 +481,7 @@ public interface Economy { * Failure, Unsupported. */ @NotNull - EconomyResponse deposit(final String pluginName, final UUID accountID, final String worldName, final BigDecimal amount); + EconomyResponse deposit(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final String worldName, @NotNull final BigDecimal amount); /** * Deposit an amount to an account associated with a UUID on a given world - @@ -496,7 +498,7 @@ public interface Economy { * Failure, Unsupported. */ @NotNull - EconomyResponse deposit(final String pluginName, final UUID accountID, final String worldName, final String currency, final BigDecimal amount); + EconomyResponse deposit(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final String worldName, @NotNull final String currency, @NotNull final BigDecimal amount); /* * Shared Account Methods @@ -511,7 +513,7 @@ public interface Economy { * @param owner the {@link UUID} of the account owner * @return true if the shared account is successfully created, false otherwise */ - boolean createSharedAccount(final String pluginName, final UUID accountID, final String name, final UUID owner); + boolean createSharedAccount(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final String name, @NotNull final UUID owner); /** * Determines whether the specified owner ID is the owner of the account associated with the given account ID and plugin name. @@ -521,7 +523,7 @@ public interface Economy { * @param uuid the {@link UUID} to check for ownership of the account * @return true if the owner ID is the owner of the account, false otherwise */ - boolean isAccountOwner(final String pluginName, final UUID accountID, final UUID uuid); + boolean isAccountOwner(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final UUID uuid); /** * Sets the owner of a specified plugin to the given accountID. @@ -531,7 +533,7 @@ public interface Economy { * @param uuid The {@link UUID} of the account to set as the owner. * @return true if the owner is successfully set, false otherwise. */ - boolean setOwner(final String pluginName, final UUID accountID, final UUID uuid); + boolean setOwner(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final UUID uuid); /** * Determines whether a specific member is an account member of a given plugin. @@ -541,7 +543,7 @@ public interface Economy { * @param uuid The {@link UUID} to check for membership. * @return true if the member is an account member, false otherwise. */ - boolean isAccountMember(final String pluginName, final UUID accountID, final UUID uuid); + boolean isAccountMember(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final UUID uuid); /** * Adds a member to an account. @@ -551,7 +553,7 @@ public interface Economy { * @param uuid The {@link UUID} of the member to be added. * @return true if the member was successfully added, false otherwise. */ - boolean addAccountMember(final String pluginName, final UUID accountID, final UUID uuid); + boolean addAccountMember(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final UUID uuid); /** * Adds a member to an account with the specified initial permissions. @@ -563,7 +565,7 @@ public interface Economy { * these should be assumed to be "true." * @return true if the member was added successfully, false otherwise. */ - boolean addAccountMember(final String pluginName, final UUID accountID, final UUID uuid, final AccountPermission... initialPermissions); + boolean addAccountMember(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final UUID uuid, @NotNull final AccountPermission... initialPermissions); /** * Removes a member from an account. @@ -573,7 +575,7 @@ public interface Economy { * @param uuid the {@link UUID} of the member to be removed * @return true if the member was successfully removed, false otherwise */ - boolean removeAccountMember(final String pluginName, final UUID accountID, final UUID uuid); + boolean removeAccountMember(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final UUID uuid); /** * Checks if the specified account has the given permission for the given plugin. @@ -584,7 +586,7 @@ public interface Economy { * @param permission the permission to check for * @return true if the account has the specified permission, false otherwise */ - boolean hasAccountPermission(final String pluginName, final UUID accountID, final UUID uuid, final AccountPermission permission); + boolean hasAccountPermission(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final UUID uuid, @NotNull final AccountPermission permission); /** * Updates the account permission for a specific plugin and user. @@ -596,5 +598,5 @@ public interface Economy { * @param value the new permission value to set for this value * @return true if the account permission was successfully updated, false otherwise */ - boolean updateAccountPermission(final String pluginName, final UUID accountID, final UUID uuid, final AccountPermission permission, final boolean value); + boolean updateAccountPermission(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final UUID uuid, @NotNull final AccountPermission permission, final boolean value); } diff --git a/src/main/java/net/milkbowl/vault2/economy/EconomyResponse.java b/src/main/java/net/milkbowl/vault2/economy/EconomyResponse.java index 6b6a881..57faabc 100644 --- a/src/main/java/net/milkbowl/vault2/economy/EconomyResponse.java +++ b/src/main/java/net/milkbowl/vault2/economy/EconomyResponse.java @@ -15,6 +15,8 @@ */ package net.milkbowl.vault2.economy; +import org.jetbrains.annotations.NotNull; + import java.math.BigDecimal; /** @@ -36,7 +38,7 @@ public enum ResponseType { private int id; - ResponseType(int id) { + ResponseType(final int id) { this.id = id; } @@ -70,7 +72,7 @@ int getId() { * @param type Success or failure type of the operation * @param errorMessage Error message if necessary (commonly null) */ - public EconomyResponse(BigDecimal amount, BigDecimal balance, ResponseType type, String errorMessage) { + public EconomyResponse(@NotNull final BigDecimal amount, @NotNull final BigDecimal balance, @NotNull final ResponseType type, @NotNull final String errorMessage) { this.amount = amount; this.balance = balance; this.type = type; From 33263730dbc27fabe45dc7c3146b0ec6146ff026 Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Sat, 28 Dec 2024 16:37:23 -0500 Subject: [PATCH 47/95] Upload Economy Badge standards. --- EconomyBadge.md | 89 +++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 10 +++++- 2 files changed, 98 insertions(+), 1 deletion(-) create mode 100644 EconomyBadge.md diff --git a/EconomyBadge.md b/EconomyBadge.md new file mode 100644 index 0000000..a0182d4 --- /dev/null +++ b/EconomyBadge.md @@ -0,0 +1,89 @@ +# VaultUnlocked Economy Support Badge: Minimum Implementation Standard + +The following document outlines the minimum implementation standard required for projects to achieve the VaultUnlocked Economy Support Badge. The requirements are divided into two categories: **Economy Plugins** (providers of the economy) and **Economy User Plugins** (e.g., banks, chest shops). + +--- + +## **Standards Checklist** + +### **1. Economy Plugins** +Economy Plugins must implement the following core methods from the Economy interface to provide comprehensive economy functionality: + +#### **Required Methods** +1. **General Methods:** + - isEnabled() + - getName() + +2. **Currency Management:** + - hasMultiCurrencySupport() + - fractionalDigits(String pluginName) + - format(String pluginName, BigDecimal amount, String currency) + - getDefaultCurrency(String pluginName) + - currencies() + +3. **Account Management:** + - createAccount(UUID accountID, String name, boolean player) + - getUUIDNameMap() + - hasAccount(UUID accountID) + - renameAccount(UUID accountID, String name) + - deleteAccount(String plugin, UUID accountID) + +4. **Account Balance Management:** + - getBalance(String pluginName, UUID accountID, String worldName, String currency) + - withdraw(String pluginName, UUID accountID, BigDecimal amount) + - deposit(String pluginName, UUID accountID, BigDecimal amount) + +#### **Optional Features** +Economy Plugins may optionally implement shared account and permission-related APIs: +- Shared Account Methods: + - createSharedAccount(String pluginName, UUID accountID, String name, UUID owner) + - isAccountOwner(String pluginName, UUID accountID, UUID uuid) + - addAccountMember(String pluginName, UUID accountID, UUID uuid, AccountPermission... permissions) + - removeAccountMember(String pluginName, UUID accountID, UUID uuid) + - hasAccountPermission(String pluginName, UUID accountID, UUID uuid, AccountPermission permission) + - updateAccountPermission(String pluginName, UUID accountID, UUID uuid, AccountPermission permission, boolean value) + +--- + +### **2. Economy User Plugins** +Economy User Plugins, such as banks, chest shops, or auction houses, must implement a minimal set of methods from the Economy interface to interact with the active economy plugin: + +#### **Required Methods** + +1. **Account Balance Management:** + - getBalance(String pluginName, UUID accountID): + - Retrieve the balance for a specific account. + - withdraw(String pluginName, UUID accountID, BigDecimal amount): + - Withdraw a specified amount from an account. + - deposit(String pluginName, UUID accountID, BigDecimal amount): + - Deposit a specified amount into an account. + +--- + +### **3. Evidence of Multi-Currency Support (For Economy Plugins Only)** +Economy Plugins must demonstrate multi-currency support by: +- Properly implementing hasMultiCurrencySupport() and returning true if supported. +- Providing functional implementations for: + - currencies() + - format(String pluginName, BigDecimal amount, String currency) + - getDefaultCurrency(String pluginName) + +--- + +## **Submission Requirements** +1. **Economy Plugins:** + - A GitHub ticket detailing: + - **Project Name** + - **Usage of VaultUnlocked** + - **Description of multi-currency support implementation** (if applicable). + - Evidence of multi-currency support (if implemented) in the form of logs or outputs. + +2. **Economy User Plugins:** + - A GitHub ticket detailing: + - **Project Name** + - **Usage of VaultUnlocked** (e.g., bank, shop, auction house). + - Evidence of successful implementation of the required balance-related methods through logs or outputs. + +--- + +By adhering to these standards, your project will demonstrate compatibility with the VaultUnlocked Economy API and earn the Economy Support Badge. While optional features enhance the plugin's functionality, implementing the required methods ensures a baseline level of integration and interoperability. \ No newline at end of file diff --git a/README.md b/README.md index f4c821d..c2dd7b2 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ How to include the API with Maven: https://repo.codemc.org/repository/maven-public + net.milkbowl.vault @@ -75,7 +76,14 @@ along with Vault. If not, see . VaultUnlockedAPI comes with all libraries needed to build from the current branch. ## Plugin Support -While VaultUnlocked works with plugins that support the original Vault, +While VaultUnlocked works with plugins that support the original Vault, the VaultUnlocked-specific API adds enhanced functionality that plugins must implement specifically. +For this, we have created a VaultUnlocked Support badge, which will be assigned to projects that meet a minimum specification outlined in [Minimum Spec Standard](EconomyBadge.md). + +### Economy Plugins +Economy providers that have VaultUnlocked support. + +### Economy User Plugins +Plugins that use VaultUnlocked to interface with Economy Plugins. ## Implementing VaultUnlocked Implementing VaultUnlocked is quite simple. It requires getting the Economy, Permission, or Chat service from the Bukkit ServiceManager. See the example below: From 78a686ae99e368a90585b9b1fee4ce2b4ee61457 Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Sat, 28 Dec 2024 19:26:47 -0500 Subject: [PATCH 48/95] Add economy badge files. --- README.md | 5 ++++- badge/economy badge.png | Bin 0 -> 3832 bytes badge/economy badge.psd | Bin 0 -> 70606 bytes EconomyBadge.md => standard/EconomyBadge.md | 0 4 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 badge/economy badge.png create mode 100644 badge/economy badge.psd rename EconomyBadge.md => standard/EconomyBadge.md (100%) diff --git a/README.md b/README.md index c2dd7b2..85d25ca 100644 --- a/README.md +++ b/README.md @@ -77,10 +77,13 @@ VaultUnlockedAPI comes with all libraries needed to build from the current branc ## Plugin Support While VaultUnlocked works with plugins that support the original Vault, the VaultUnlocked-specific API adds enhanced functionality that plugins must implement specifically. -For this, we have created a VaultUnlocked Support badge, which will be assigned to projects that meet a minimum specification outlined in [Minimum Spec Standard](EconomyBadge.md). +For this, we have created a VaultUnlocked Support badge, which will be assigned to projects that meet a minimum specification outlined in [Minimum Spec Standard](standard/EconomyBadge.md). ### Economy Plugins Economy providers that have VaultUnlocked support. +- TheNewEconomy +- Polyconomy +- iConomyUnlocked ### Economy User Plugins Plugins that use VaultUnlocked to interface with Economy Plugins. diff --git a/badge/economy badge.png b/badge/economy badge.png new file mode 100644 index 0000000000000000000000000000000000000000..5192b303d205056cad78d7cd87c951e7193d2ef6 GIT binary patch literal 3832 zcmV(_`g8%^e{{R4h=>PzAFaQARU;qF*m;eA5Z<1fd zMgRZ~en~_@RCwC#oLg)ZSDway=T!B@cKd=89Bz{yU@%!F5VEY5m?VrKgEkW(GC>N% zgCAB(1V~}E3lSMbC_E&Kq6B5&!I2U!Vjipod8DxMqFh7oLa|9}C&x970Hb@pp>}@zcV}ZGQ|0;U@|+Z|AUW8>uyDmvp+IMIiwlr9p#I z9$_PLRF@hJ2<`PF+~ae(EE*Y(c!&@aA*j-V@`z^HT#XQlE5li|_N3HTQ6LdDK||l5 zjnZHk22u!WD#3CYR1* z8j30@z&B65ze+)0|1dclzUsBG9gUC@Qws9g2r*MqRUSbK5s=$KdKzru00M=Sp@|zJ z#Do>pC80*4k%p^;dW70(AeUEIw!kdA4HVe6jU!+Am_`j1I=*2dpL`+4w z6i5Nc2nd0+HI4$MatIwNXo&yYSX}oSXM3LgaTQbpmIKlY_4pwoDIlgKj#A_uftC`( zFp-9dZ97=GJeiy#m(ye&P(l+$AOVd4ArL~~I4xBf>T9eJg*_1?RfiSKSR3H$-LTgPr;}9>mdC1BULvZEF6*8F&eM6Grbd2Fn11Z7q z(khP2N`!E;H$#?#n52Mi+qR8VDiyNiZ-fVb*2 z+GuHMxvq-u+qaK9?zn@89(st{+FAfQJ3DD@ZRPao(*u>D$2^rf@AjX-OJjw zYiVq3EI5b0zCJc>+EiqntX#R0ojZ3FlS1^-ntw z@JZLxMK}16)kDkKJ6K%z8q1PfgY6f3-{yEx2*_?c2w(W5;M}YU26lpXcS5 zUnZ4G6}8*FdpD;~pQfp)i8tPOBWPC&k3IGn2M!$I=+UF>-Mbfn*|TS}Wy==2y1Ihn zwrtrFkfo!egYDb5)7aR^>eZ{6KYxC~L@*L_=FDNqk|ngXv`|q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%GVK2V7lh#9$jsss%)9(`UqQZ#Qok>V> zToJVXBmM2`;vS41UqrMlt`E}vV{8H3zw&lf16t6Kdq`0oCjy9+1v^0{ds`%>CrCLi zks7Qd<#gPX|))y`;U#(146f z@Bk6#MS*%`VuCwyemVd;G21XoC4K)QQti}(oU#U`-uO?Q4?7^sZOMt=qA+! zwq*3JhaRxx%Ca>2J;<=ya;(< z4j>E5f)QdctVg(7@8h~4+u%l_8Ie$QVOyVOp%JDRx(tOD?G}3*wQvbWZRb8{MYj!Z;F^zh!=$&F? Date: Sat, 28 Dec 2024 20:13:04 -0500 Subject: [PATCH 49/95] Add deprecated javadocs and annotations with as of version. --- .../net/milkbowl/vault2/economy/Economy.java | 67 +++++++++++++++++-- 1 file changed, 63 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/milkbowl/vault2/economy/Economy.java b/src/main/java/net/milkbowl/vault2/economy/Economy.java index ccb118d..cef97ae 100644 --- a/src/main/java/net/milkbowl/vault2/economy/Economy.java +++ b/src/main/java/net/milkbowl/vault2/economy/Economy.java @@ -84,10 +84,12 @@ public interface Economy { * Plugins use this method to format a given BigDecimal amount into a human-readable * amount using your economy plugin's currency names/conventions. * + * @deprecated This method is deprecated as of version 2.8, and has been replaced by {@link #format(String, BigDecimal)}. + * This allows economy plugins to know exactly if the account is a player or not. This will be removed after 3 releases. + * * @param amount to format. * * @return Human-readable string describing amount, ie 5 Dollars or 5.55 Pounds. - * @deprecated Use {@link #format(String, BigDecimal)} instead. */ @NotNull @Deprecated @@ -109,11 +111,13 @@ public interface Economy { * Plugins use this method to format a given BigDecimal amount into a human-readable * amount using your economy plugin's currency names/conventions. * + * @deprecated This method is deprecated as of version 2.8, and has been replaced by {@link #format(String, BigDecimal, String)}. + * This allows economy plugins to know exactly if the account is a player or not. This will be removed after 3 releases. + * * @param amount to format. * @param currency the currency to use for the format. * * @return Human-readable string describing amount, ie 5 Dollars or 5.55 Pounds. - * @deprecated Use {@link #format(String, BigDecimal, String)} instead. */ @NotNull @Deprecated @@ -190,13 +194,14 @@ public interface Economy { /** * Attempts to create an account for the given UUID. * - * @deprecated This method is deprecated, and has been replaced by {@link #createAccount(UUID, String, String, boolean)}. + * @deprecated This method is deprecated as of version 2.8, and has been replaced by {@link #createAccount(UUID, String, String, boolean)}. * This allows economy plugins to know exactly if the account is a player or not. This will be removed after 3 releases. * * @param accountID UUID associated with the account. * @param name UUID associated with the account. * @return true if the account creation was successful. */ + @Deprecated boolean createAccount(@NotNull final UUID accountID, @NotNull final String name); /** @@ -215,7 +220,7 @@ public interface Economy { * IMPLEMENTATION SPECIFIC - if an economy plugin does not support this then * false will always be returned. * - * @deprecated This method is deprecated, and has been replaced by {@link #createAccount(UUID, String, String, boolean)}. + * @deprecated This method is deprecated as of version 2.8, and has been replaced by {@link #createAccount(UUID, String, String, boolean)}. * This allows economy plugins to know exactly if the account is a player or not. This will be removed after 3 releases. * * @param accountID UUID associated with the account. @@ -223,6 +228,7 @@ public interface Economy { * @param worldName String name of the world. * @return if the account creation was successful */ + @Deprecated boolean createAccount(@NotNull final UUID accountID, @NotNull final String name, @NotNull final String worldName); /** @@ -334,29 +340,40 @@ public interface Economy { /** * Gets balance of an account associated with a UUID. * + * @deprecated This method is deprecated as of version 2.9, and has been replaced by {@link #balance(String, UUID)}. + * This allows economy plugins to know exactly if the account is a player or not. This will be removed after 3 releases. + * * @param pluginName The name of the plugin that is calling the method. * @param accountID UUID of the account to get a balance for. * @return Amount currently held in account associated with the given UUID. */ @NotNull + @Deprecated BigDecimal getBalance(@NotNull final String pluginName, @NotNull final UUID accountID); /** * 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. * + * @deprecated This method is deprecated as of version 2.9, and has been replaced by {@link #balance(String, UUID, String)}. + * This allows economy plugins to know exactly if the account is a player or not. This will be removed after 3 releases. + * * @param pluginName The name of the plugin that is calling the method. * @param accountID 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. */ @NotNull + @Deprecated BigDecimal getBalance(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final String world); /** * 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. * + * @deprecated This method is deprecated as of version 2.9, and has been replaced by {@link #balance(String, UUID, String, String)}. + * This allows economy plugins to know exactly if the account is a player or not. This will be removed after 3 releases. + * * @param pluginName The name of the plugin that is calling the method. * @param accountID UUID of the account to get a balance for. * @param world name of the world. @@ -364,8 +381,50 @@ public interface Economy { * @return Amount currently held in account associated with the given UUID. */ @NotNull + @Deprecated BigDecimal getBalance(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final String world, @NotNull final String currency); + /** + * Gets balance of an account associated with a UUID. + * + * @param pluginName The name of the plugin that is calling the method. + * @param accountID UUID of the account to get a balance for. + * @return Amount currently held in account associated with the given UUID. + */ + @NotNull + default BigDecimal balance(@NotNull final String pluginName, @NotNull final UUID accountID) { + return getBalance(pluginName, accountID); + } + + /** + * 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 pluginName The name of the plugin that is calling the method. + * @param accountID 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. + */ + @NotNull + default BigDecimal balance(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final String world) { + return getBalance(pluginName, accountID, world); + } + + /** + * 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 pluginName The name of the plugin that is calling the method. + * @param accountID UUID of the account to get a balance for. + * @param world name of the world. + * @param currency the currency to use. + * @return Amount currently held in account associated with the given UUID. + */ + @NotNull + default BigDecimal balance(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final String world, @NotNull final String currency) { + return getBalance(pluginName, accountID, world, currency); + } + /** * Checks if the account associated with the given UUID has the amount - DO NOT * USE NEGATIVE AMOUNTS. From e23ee01d8204346a22f35350d1cd6e578e0ef971 Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Sat, 28 Dec 2024 21:10:44 -0500 Subject: [PATCH 50/95] Add issue templates for feature request and badge review. --- {badge => .badge}/economy badge.png | Bin {badge => .badge}/economy badge.psd | Bin .github/ISSUE_TEMPLATE/request-a-feature.yml | 27 +++++++++++ .../ISSUE_TEMPLATE/request-badge-review.yml | 42 ++++++++++++++++++ {standard => .standard}/EconomyBadge.md | 0 README.md | 2 +- 6 files changed, 70 insertions(+), 1 deletion(-) rename {badge => .badge}/economy badge.png (100%) rename {badge => .badge}/economy badge.psd (100%) create mode 100644 .github/ISSUE_TEMPLATE/request-a-feature.yml create mode 100644 .github/ISSUE_TEMPLATE/request-badge-review.yml rename {standard => .standard}/EconomyBadge.md (100%) diff --git a/badge/economy badge.png b/.badge/economy badge.png similarity index 100% rename from badge/economy badge.png rename to .badge/economy badge.png diff --git a/badge/economy badge.psd b/.badge/economy badge.psd similarity index 100% rename from badge/economy badge.psd rename to .badge/economy badge.psd diff --git a/.github/ISSUE_TEMPLATE/request-a-feature.yml b/.github/ISSUE_TEMPLATE/request-a-feature.yml new file mode 100644 index 0000000..56d4488 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/request-a-feature.yml @@ -0,0 +1,27 @@ +name: Feature Request +description: Suggest a feature to be added in order to help Vault Unlocked improve. +title: "[FEAT]: " +labels: [ "feature" ] +assignees: + - creatorfromhell + +body: + - type: markdown + attributes: + value: Thanks for helping to improve Vault Unlocked with feature requests! + - type: textarea + attributes: + label: Feature Description + description: Describe the feature you're requesting to be added here. + placeholder: | + Example: "Add a new method that gives everyone funds!" + validations: + required: true + - type: textarea + attributes: + label: Reasoning + description: Why should this be added? What is the use-case? + placeholder: | + Example: "Global wealth!@#!@#!" + validations: + required: true \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/request-badge-review.yml b/.github/ISSUE_TEMPLATE/request-badge-review.yml new file mode 100644 index 0000000..9712df7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/request-badge-review.yml @@ -0,0 +1,42 @@ +name: BADGE REVIEW +description: Request a review of a project for a Vault Unlocked Support Badge. +title: "[BADGE REVIEW]: " +labels: [ "badge review" ] +assignees: +- creatorfromhell + +body: +- type: dropdown + id: dropdown-1 + attributes: + label: Badge Type + description: The type of badge that is being requested. + options: + - Economy + default: 0 + validations: + required: true +- type: input + id: input-2 + attributes: + label: Project Name + description: The name of your project + placeholder: Example Project + validations: + required: true +- type: input + id: input-3 + attributes: + label: Project URL + description: The URL of your project. + placeholder: https://tnemc.net + validations: + required: true +- type: input + id: input-4 + attributes: + label: Source URL + description: The source of your project. + placeholder: https://github.com/TheNewEconomy/VaultUnlockedAPI + validations: + required: true \ No newline at end of file diff --git a/standard/EconomyBadge.md b/.standard/EconomyBadge.md similarity index 100% rename from standard/EconomyBadge.md rename to .standard/EconomyBadge.md diff --git a/README.md b/README.md index 85d25ca..1d5fb3b 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,7 @@ VaultUnlockedAPI comes with all libraries needed to build from the current branc ## Plugin Support While VaultUnlocked works with plugins that support the original Vault, the VaultUnlocked-specific API adds enhanced functionality that plugins must implement specifically. -For this, we have created a VaultUnlocked Support badge, which will be assigned to projects that meet a minimum specification outlined in [Minimum Spec Standard](standard/EconomyBadge.md). +For this, we have created a VaultUnlocked Support badge, which will be assigned to projects that meet a minimum specification outlined in [Minimum Spec Standard](.standard/EconomyBadge.md). ### Economy Plugins Economy providers that have VaultUnlocked support. From af9db986a9e650ca5ca9d749f6c66a4c62d3b3ae Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Sat, 28 Dec 2024 21:40:06 -0500 Subject: [PATCH 51/95] Add changelog files to repository. --- .changelog/2.9.0.md | 16 ++++++++++++++++ .changelog/template.md | 11 +++++++++++ .standard/EconomyBadge.md | 2 +- 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 .changelog/2.9.0.md create mode 100644 .changelog/template.md diff --git a/.changelog/2.9.0.md b/.changelog/2.9.0.md new file mode 100644 index 0000000..de64afe --- /dev/null +++ b/.changelog/2.9.0.md @@ -0,0 +1,16 @@ +# 2.9.0 + +## API Changes +- Added standards for minimum Vault Unlocked Support. Projects that meet these standards may request + a review to use the badge associated with the API type(economy, etc) that they use. +- Added balance methods in same format as the old getBalance methods. + +## Plugin Changes + +## Fixes + +## Deprecations +- Deprecated getBalance methods, these are marked for removal in 3 releases. Use balance methods instead. +- Deprecated createAccount methods without nonPlayer. Use the methods that include the nonPlayer parameter. + +## Removals \ No newline at end of file diff --git a/.changelog/template.md b/.changelog/template.md new file mode 100644 index 0000000..9eead67 --- /dev/null +++ b/.changelog/template.md @@ -0,0 +1,11 @@ +# Version + +## API Changes + +## Plugin Changes + +## Fixes + +## Deprecations + +## Removals \ No newline at end of file diff --git a/.standard/EconomyBadge.md b/.standard/EconomyBadge.md index a0182d4..79e5542 100644 --- a/.standard/EconomyBadge.md +++ b/.standard/EconomyBadge.md @@ -29,7 +29,7 @@ Economy Plugins must implement the following core methods from the Economy inter - deleteAccount(String plugin, UUID accountID) 4. **Account Balance Management:** - - getBalance(String pluginName, UUID accountID, String worldName, String currency) + - balance(String pluginName, UUID accountID, String worldName, String currency) - withdraw(String pluginName, UUID accountID, BigDecimal amount) - deposit(String pluginName, UUID accountID, BigDecimal amount) From bca72911f76c28139a42578a0cf273fbf4d44115 Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Sun, 29 Dec 2024 13:44:27 -0500 Subject: [PATCH 52/95] Updated comments in deprecateed method Javadocs, and README version. --- README.md | 4 ++-- src/main/java/net/milkbowl/vault2/economy/Economy.java | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 1d5fb3b..62fe2e8 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ How to include the API with Maven: net.milkbowl.vault VaultUnlockedAPI - 2.4 + 2.9 provided @@ -25,7 +25,7 @@ repositories { maven { url 'https://repo.codemc.org/repository/maven-public' } } dependencies { - compileOnly "net.milkbowl.vault:VaultUnlockedAPI:2.4" + compileOnly "net.milkbowl.vault:VaultUnlockedAPI:2.9" } ``` diff --git a/src/main/java/net/milkbowl/vault2/economy/Economy.java b/src/main/java/net/milkbowl/vault2/economy/Economy.java index cef97ae..50f37cc 100644 --- a/src/main/java/net/milkbowl/vault2/economy/Economy.java +++ b/src/main/java/net/milkbowl/vault2/economy/Economy.java @@ -195,7 +195,7 @@ public interface Economy { * Attempts to create an account for the given UUID. * * @deprecated This method is deprecated as of version 2.8, and has been replaced by {@link #createAccount(UUID, String, String, boolean)}. - * This allows economy plugins to know exactly if the account is a player or not. This will be removed after 3 releases. + * This allows economy plugins to know exactly if the account is a player or not. This may be removed in a future release. * * @param accountID UUID associated with the account. * @param name UUID associated with the account. @@ -221,7 +221,7 @@ public interface Economy { * false will always be returned. * * @deprecated This method is deprecated as of version 2.8, and has been replaced by {@link #createAccount(UUID, String, String, boolean)}. - * This allows economy plugins to know exactly if the account is a player or not. This will be removed after 3 releases. + * This allows economy plugins to know exactly if the account is a player or not. This may be removed in a future release. * * @param accountID UUID associated with the account. * @param name UUID associated with the account. @@ -341,7 +341,7 @@ public interface Economy { * Gets balance of an account associated with a UUID. * * @deprecated This method is deprecated as of version 2.9, and has been replaced by {@link #balance(String, UUID)}. - * This allows economy plugins to know exactly if the account is a player or not. This will be removed after 3 releases. + * This allows economy plugins to know exactly if the account is a player or not. This may be removed in a future release. * * @param pluginName The name of the plugin that is calling the method. * @param accountID UUID of the account to get a balance for. @@ -356,7 +356,7 @@ public interface Economy { * an economy plugin does not support this the global balance will be returned. * * @deprecated This method is deprecated as of version 2.9, and has been replaced by {@link #balance(String, UUID, String)}. - * This allows economy plugins to know exactly if the account is a player or not. This will be removed after 3 releases. + * This allows economy plugins to know exactly if the account is a player or not. This may be removed in a future release. * * @param pluginName The name of the plugin that is calling the method. * @param accountID UUID of the account to get a balance for. @@ -372,7 +372,7 @@ public interface Economy { * an economy plugin does not support this the global balance will be returned. * * @deprecated This method is deprecated as of version 2.9, and has been replaced by {@link #balance(String, UUID, String, String)}. - * This allows economy plugins to know exactly if the account is a player or not. This will be removed after 3 releases. + * This allows economy plugins to know exactly if the account is a player or not. This may be removed in a future release. * * @param pluginName The name of the plugin that is calling the method. * @param accountID UUID of the account to get a balance for. From f52750c50b69ad9f7c58c9ce5d358b9363f36465 Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Sun, 29 Dec 2024 14:02:20 -0500 Subject: [PATCH 53/95] Update more comments in javadocs. --- src/main/java/net/milkbowl/vault2/economy/Economy.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/milkbowl/vault2/economy/Economy.java b/src/main/java/net/milkbowl/vault2/economy/Economy.java index 50f37cc..d50f71b 100644 --- a/src/main/java/net/milkbowl/vault2/economy/Economy.java +++ b/src/main/java/net/milkbowl/vault2/economy/Economy.java @@ -85,7 +85,7 @@ public interface Economy { * amount using your economy plugin's currency names/conventions. * * @deprecated This method is deprecated as of version 2.8, and has been replaced by {@link #format(String, BigDecimal)}. - * This allows economy plugins to know exactly if the account is a player or not. This will be removed after 3 releases. + * This allows economy plugins to know exactly if the account is a player or not. This may be removed in a future release. * * @param amount to format. * @@ -112,7 +112,7 @@ public interface Economy { * amount using your economy plugin's currency names/conventions. * * @deprecated This method is deprecated as of version 2.8, and has been replaced by {@link #format(String, BigDecimal, String)}. - * This allows economy plugins to know exactly if the account is a player or not. This will be removed after 3 releases. + * This allows economy plugins to know exactly if the account is a player or not. This may be removed in a future release. * * @param amount to format. * @param currency the currency to use for the format. From d7e380d3fac687aac2cbea44377e7e9d43a27f8d Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Sun, 29 Dec 2024 14:27:06 -0500 Subject: [PATCH 54/95] Modify badge review standard and issue template. --- .../ISSUE_TEMPLATE/request-badge-review.yml | 66 ++++++++++++++++++- .standard/EconomyBadge.md | 41 ++++-------- 2 files changed, 79 insertions(+), 28 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/request-badge-review.yml b/.github/ISSUE_TEMPLATE/request-badge-review.yml index 9712df7..5affdb8 100644 --- a/.github/ISSUE_TEMPLATE/request-badge-review.yml +++ b/.github/ISSUE_TEMPLATE/request-badge-review.yml @@ -39,4 +39,68 @@ body: description: The source of your project. placeholder: https://github.com/TheNewEconomy/VaultUnlockedAPI validations: - required: true \ No newline at end of file + required: true + +### Economy Plugin Checklist + +- type: checkboxes + id: core-functionality + attributes: + label: Core Functionality + description: Implement all required functionality from the Economy interface. + options: + - label: "Fully implement all non-default methods from the Economy interface" + required: false + - label: "Implement boolean hasSharedAccountSupport()" + required: false + - label: "Implement boolean hasMultiCurrencySupport()" + required: false + - label: "Default to the base currency if multi-currency functionality is not supported" + required: false + - label: "Specify lack of multi-currency support on the project page or GitHub repository" + required: false + +- type: checkboxes + id: optional-features + attributes: + label: Optional Features + description: Implement optional shared account methods. + options: + - label: "Implement createSharedAccount(String pluginName, UUID accountID, String name, UUID owner)" + required: false + - label: "Implement isAccountOwner(String pluginName, UUID accountID, UUID uuid)" + required: false + - label: "Implement addAccountMember(String pluginName, UUID accountID, UUID uuid, AccountPermission... permissions)" + required: false + - label: "Implement removeAccountMember(String pluginName, UUID accountID, UUID uuid)" + required: false + - label: "Implement hasAccountPermission(String pluginName, UUID accountID, UUID uuid, AccountPermission permission)" + required: false + - label: "Implement updateAccountPermission(String pluginName, UUID accountID, UUID uuid, AccountPermission permission, boolean value)" + required: false + +- type: checkboxes + id: user-plugin-methods + attributes: + label: Economy User Plugin Methods + description: Implement the required methods for Economy User Plugins. + options: + - label: "Implement balance(String pluginName, UUID accountID)" + required: false + - label: "Implement withdraw(String pluginName, UUID accountID, BigDecimal amount)" + required: false + - label: "Implement deposit(String pluginName, UUID accountID, BigDecimal amount)" + required: false + +- type: checkboxes + id: multi-currency-support + attributes: + label: Multi-Currency Support + description: Verify and document multi-currency support. + options: + - label: "Properly implement hasMultiCurrencySupport() and ensure it returns true if supported" + required: false + - label: "Provide functional implementation for currencies()" + required: false + - label: "Provide functional implementation for getDefaultCurrency(String pluginName)" + required: false diff --git a/.standard/EconomyBadge.md b/.standard/EconomyBadge.md index 79e5542..e5acda2 100644 --- a/.standard/EconomyBadge.md +++ b/.standard/EconomyBadge.md @@ -7,31 +7,15 @@ The following document outlines the minimum implementation standard required for ## **Standards Checklist** ### **1. Economy Plugins** -Economy Plugins must implement the following core methods from the Economy interface to provide comprehensive economy functionality: +Economy Plugins must implement the following core functionality from the Economy interface to provide comprehensive economy functionality: -#### **Required Methods** -1. **General Methods:** - - isEnabled() - - getName() - -2. **Currency Management:** - - hasMultiCurrencySupport() - - fractionalDigits(String pluginName) - - format(String pluginName, BigDecimal amount, String currency) - - getDefaultCurrency(String pluginName) - - currencies() - -3. **Account Management:** - - createAccount(UUID accountID, String name, boolean player) - - getUUIDNameMap() - - hasAccount(UUID accountID) - - renameAccount(UUID accountID, String name) - - deleteAccount(String plugin, UUID accountID) - -4. **Account Balance Management:** - - balance(String pluginName, UUID accountID, String worldName, String currency) - - withdraw(String pluginName, UUID accountID, BigDecimal amount) - - deposit(String pluginName, UUID accountID, BigDecimal amount) +#### **Required Functionality** +- Fully Implement the non-default methods. +- Implement the methods for optional functionality: + - boolean hasSharedAccountSupport(); + - boolean hasMultiCurrencySupport(); +- If your plugin doesn't support the multi-currency functionality, defaulting to your base currency, and +specifying this on your project page, or GitHub repository. #### **Optional Features** Economy Plugins may optionally implement shared account and permission-related APIs: @@ -46,12 +30,12 @@ Economy Plugins may optionally implement shared account and permission-related A --- ### **2. Economy User Plugins** -Economy User Plugins, such as banks, chest shops, or auction houses, must implement a minimal set of methods from the Economy interface to interact with the active economy plugin: +Economy User Plugins, such as banks, chest shops, or auction houses, must implement a minimal set of functionality from the Economy interface to achieve "minimum implementation." #### **Required Methods** 1. **Account Balance Management:** - - getBalance(String pluginName, UUID accountID): + - balance(String pluginName, UUID accountID): - Retrieve the balance for a specific account. - withdraw(String pluginName, UUID accountID, BigDecimal amount): - Withdraw a specified amount from an account. @@ -60,12 +44,15 @@ Economy User Plugins, such as banks, chest shops, or auction houses, must implem --- +#### **Multi-Currency Support** +If you're third-party plugin doesn't support using a different currency for your plugin, please make +sure to have this specified on the project page, or GitHub repository. + ### **3. Evidence of Multi-Currency Support (For Economy Plugins Only)** Economy Plugins must demonstrate multi-currency support by: - Properly implementing hasMultiCurrencySupport() and returning true if supported. - Providing functional implementations for: - currencies() - - format(String pluginName, BigDecimal amount, String currency) - getDefaultCurrency(String pluginName) --- From 465a989e909fa60ae00e44ef13672efee3316da4 Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Sun, 29 Dec 2024 14:30:15 -0500 Subject: [PATCH 55/95] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 62fe2e8..20c427e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# VaultUnlockedAPI - Abstraction Library API for Bukkit Plugins - [![Build Status](https://ci.codemc.io/job/creatorfromhell/job/VaultUnlockedAPI/badge/icon)](https://ci.codemc.io/job/creatorfromhell/job/VaultUnlockedAPI/) +# VaultUnlockedAPI - Abstraction Library API for Bukkit Plugins - [![Build Status](https://ci.codemc.io/job/creatorfromhell/job/VaultUnlockedAPI/badge/icon)](https://ci.codemc.io/job/creatorfromhell/job/VaultUnlockedAPI/) [![Economy Badge](https://github.com/TheNewEconomy/VaultUnlockedAPI/blob/master/.badge/economy%20badge.png)](https://github.com/TheNewEconomy/VaultUnlockedAPI) How to include the API with Maven: ```xml From d52b7bbff5959832d4a4b0e0712726022a20dc55 Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Sun, 29 Dec 2024 14:36:06 -0500 Subject: [PATCH 56/95] Update request-badge-review.yml --- .github/ISSUE_TEMPLATE/request-badge-review.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/ISSUE_TEMPLATE/request-badge-review.yml b/.github/ISSUE_TEMPLATE/request-badge-review.yml index 5affdb8..9566990 100644 --- a/.github/ISSUE_TEMPLATE/request-badge-review.yml +++ b/.github/ISSUE_TEMPLATE/request-badge-review.yml @@ -68,6 +68,8 @@ body: options: - label: "Implement createSharedAccount(String pluginName, UUID accountID, String name, UUID owner)" required: false + - label: I confirm that I have not read these checkboxes, so I just ticked them all. + required: false - label: "Implement isAccountOwner(String pluginName, UUID accountID, UUID uuid)" required: false - label: "Implement addAccountMember(String pluginName, UUID accountID, UUID uuid, AccountPermission... permissions)" From 65b2f3f84fe807b1da317990e98a565ffb656058 Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Thu, 27 Mar 2025 17:25:46 -0400 Subject: [PATCH 57/95] Add set method to Economy.java --- .changelog/2.10.0.md | 9 +++ README.md | 2 +- pom.xml | 2 +- .../net/milkbowl/vault2/economy/Economy.java | 75 +++++++++++++++++++ 4 files changed, 86 insertions(+), 2 deletions(-) create mode 100644 .changelog/2.10.0.md diff --git a/.changelog/2.10.0.md b/.changelog/2.10.0.md new file mode 100644 index 0000000..39d5bd7 --- /dev/null +++ b/.changelog/2.10.0.md @@ -0,0 +1,9 @@ +# 2.10.0 + +## API Changes +- Implemented set api methods, which can be used to set the balance for accounts. +```java + EconomyResponse set(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final BigDecimal amount); + EconomyResponse set(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final String worldName, @NotNull final BigDecimal amount); + EconomyResponse set(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final String worldName, @NotNull final String currency, @NotNull final BigDecimal amount); +``` \ No newline at end of file diff --git a/README.md b/README.md index 20c427e..eff5fb5 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ How to include the API with Maven: net.milkbowl.vault VaultUnlockedAPI - 2.9 + 2.10 provided diff --git a/pom.xml b/pom.xml index df8087f..49472f8 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 net.milkbowl.vault VaultUnlockedAPI - 2.9 + 2.10 VaultUnlockedAPI diff --git a/src/main/java/net/milkbowl/vault2/economy/Economy.java b/src/main/java/net/milkbowl/vault2/economy/Economy.java index d50f71b..947f7b4 100644 --- a/src/main/java/net/milkbowl/vault2/economy/Economy.java +++ b/src/main/java/net/milkbowl/vault2/economy/Economy.java @@ -465,6 +465,81 @@ default BigDecimal balance(@NotNull final String pluginName, @NotNull final UUID */ boolean has(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final String worldName, @NotNull final String currency, @NotNull final BigDecimal amount); + /** + * + * Sets the amount of monies for a player. + * + * @param pluginName the name of the plugin setting the currency + * @param accountID the unique identifier of the player's account + * @param amount the amount of currency to set for the player in the specified world + * @return an EconomyResponse object indicating the result of the operation + */ + default EconomyResponse set(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final BigDecimal amount) { + + final BigDecimal balance = balance(pluginName, accountID); + final int compare = balance.compareTo(amount); + if(compare > 0) { + return withdraw(pluginName, accountID, balance.subtract(amount)); + } + + if(compare < 0) { + return deposit(pluginName, accountID, amount.subtract(balance)); + } + + return new EconomyResponse(BigDecimal.ZERO, amount, ResponseType.SUCCESS, ""); + } + + /** + * + * Sets the amount of monies for a player in a specific world. + * + * @param pluginName the name of the plugin setting the currency + * @param accountID the unique identifier of the player's account + * @param worldName the name of the world where the currency amount is being set + * @param amount the amount of currency to set for the player in the specified world + * @return an EconomyResponse object indicating the result of the operation + */ + default EconomyResponse set(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final String worldName, @NotNull final BigDecimal amount) { + + final BigDecimal balance = balance(pluginName, accountID, worldName); + final int compare = balance.compareTo(amount); + if(compare > 0) { + return withdraw(pluginName, accountID, worldName, balance.subtract(amount)); + } + + if(compare < 0) { + return deposit(pluginName, accountID, worldName, amount.subtract(balance)); + } + + return new EconomyResponse(BigDecimal.ZERO, amount, ResponseType.SUCCESS, ""); + } + + /** + * + * Sets the amount of specified currency for a player in a specific world. + * + * @param pluginName the name of the plugin setting the currency + * @param accountID the unique identifier of the player's account + * @param worldName the name of the world where the currency amount is being set + * @param currency the name of the currency being set + * @param amount the amount of currency to set for the player in the specified world + * @return an EconomyResponse object indicating the result of the operation + */ + default EconomyResponse set(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final String worldName, @NotNull final String currency, @NotNull final BigDecimal amount) { + + final BigDecimal balance = balance(pluginName, accountID, worldName, currency); + final int compare = balance.compareTo(amount); + if(compare > 0) { + return withdraw(pluginName, accountID, worldName, currency, balance.subtract(amount)); + } + + if(compare < 0) { + return deposit(pluginName, accountID, worldName, currency, amount.subtract(balance)); + } + + return new EconomyResponse(BigDecimal.ZERO, amount, ResponseType.SUCCESS, ""); + } + /** * Withdraw an amount from an account associated with a UUID - DO NOT USE * NEGATIVE AMOUNTS. From ea41b2011bde777fc4b2febbcc26f5ce8a64ecce Mon Sep 17 00:00:00 2001 From: MCdragonmaster <116000479+MCdragonmasters@users.noreply.github.com> Date: Fri, 4 Apr 2025 09:54:04 -0400 Subject: [PATCH 58/95] Update maven.yml --- .github/workflows/maven.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 95111fb..41aaef1 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -33,7 +33,7 @@ jobs: # run: mvn -B javadoc:jar --file pom.xml - name: Stage the artifact run: mkdir staging && cp target/*.jar staging - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: VaultUnlockedAPI path: staging From 1afad2cf52c6d5e795dba4a5cd5eba4002308b67 Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Fri, 4 Apr 2025 19:26:19 -0400 Subject: [PATCH 59/95] Update release.yml --- .github/workflows/release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8eabd27..f9aa726 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,13 +7,13 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout main branch - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Checkout gh-pages branch - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: ref: gh-pages path: gh-pages - - uses: actions/setup-java@v1 + - uses: actions/setup-java@v4 with: java-version: 1.8 - name: Build and publish package From afb3b0b27fde62e570d6b73e7e8db557928f8b1b Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Fri, 4 Apr 2025 19:31:52 -0400 Subject: [PATCH 60/95] Update release.yml --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f9aa726..fa94f63 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,6 +15,7 @@ jobs: path: gh-pages - uses: actions/setup-java@v4 with: + distribution: 'temurin' java-version: 1.8 - name: Build and publish package env: From ccc0b350adaf6216151c87cd0052ff9692658112 Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Fri, 4 Apr 2025 19:35:40 -0400 Subject: [PATCH 61/95] Update release.yml --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fa94f63..50a0fc6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,7 +16,7 @@ jobs: - uses: actions/setup-java@v4 with: distribution: 'temurin' - java-version: 1.8 + java-version: 8 - name: Build and publish package env: GITHUB_TOKEN: ${{ github.token }} From 698e841f94d281e1ec3f0967e56cfa1b20a69309 Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Fri, 4 Apr 2025 19:47:56 -0400 Subject: [PATCH 62/95] Update javadocs. --- .../net/milkbowl/vault/economy/Economy.java | 65 +++++- .../net/milkbowl/vault2/economy/Economy.java | 2 +- .../vault2/permission/Permission.java | 198 ++++++++++++++---- 3 files changed, 221 insertions(+), 44 deletions(-) diff --git a/src/main/java/net/milkbowl/vault/economy/Economy.java b/src/main/java/net/milkbowl/vault/economy/Economy.java index 5e0f427..5c22afc 100644 --- a/src/main/java/net/milkbowl/vault/economy/Economy.java +++ b/src/main/java/net/milkbowl/vault/economy/Economy.java @@ -80,7 +80,11 @@ public interface Economy { String currencyNameSingular(); /** - * + * 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 playerName to check * @deprecated As of VaultAPI 1.4 use {@link #hasAccount(OfflinePlayer)} instead. */ @Deprecated @@ -97,6 +101,12 @@ public interface Economy { boolean hasAccount(OfflinePlayer player); /** + * 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 playerName to check in the world + * @param worldName world-specific account * @deprecated As of VaultAPI 1.4 use {@link #hasAccount(OfflinePlayer, String)} instead. */ @Deprecated @@ -114,6 +124,10 @@ public interface Economy { boolean hasAccount(OfflinePlayer player, String worldName); /** + * Gets balance of a player + * + * @param playerName of the player + * @return Amount currently held in players account * @deprecated As of VaultAPI 1.4 use {@link #getBalance(OfflinePlayer)} instead. */ @Deprecated @@ -128,6 +142,11 @@ public interface Economy { double getBalance(OfflinePlayer player); /** + * 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 playerName to check + * @param world name of the world + * @return Amount currently held in players account * @deprecated As of VaultAPI 1.4 use {@link #getBalance(OfflinePlayer, String)} instead. */ @Deprecated @@ -143,6 +162,11 @@ public interface Economy { double getBalance(OfflinePlayer player, String world); /** + * Checks if the player account has the amount - DO NOT USE NEGATIVE AMOUNTS + * + * @param playerName to check + * @param amount to check for + * @return True if player has amount, False else wise * @deprecated As of VaultAPI 1.4 use {@link #has(OfflinePlayer, double)} instead. */ @Deprecated @@ -175,6 +199,11 @@ public interface Economy { boolean has(OfflinePlayer player, String worldName, double amount); /** + * Withdraw an amount from a player - DO NOT USE NEGATIVE AMOUNTS + * + * @param playerName to withdraw from + * @param amount Amount to withdraw + * @return Detailed response of transaction * @deprecated As of VaultAPI 1.4 use {@link #withdrawPlayer(OfflinePlayer, double)} instead. */ @Deprecated @@ -206,6 +235,11 @@ public interface Economy { EconomyResponse withdrawPlayer(OfflinePlayer player, String worldName, double amount); /** + * Deposit an amount to a player - DO NOT USE NEGATIVE AMOUNTS + * + * @param playerName to deposit to + * @param amount Amount to deposit + * @return Detailed response of transaction * @deprecated As of VaultAPI 1.4 use {@link #depositPlayer(OfflinePlayer, double)} instead. */ @Deprecated @@ -221,6 +255,13 @@ public interface Economy { EconomyResponse depositPlayer(OfflinePlayer player, double amount); /** + * 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 playerName to deposit to + * @param worldName name of the world + * @param amount Amount to deposit + * @return Detailed response of transaction * @deprecated As of VaultAPI 1.4 use {@link #depositPlayer(OfflinePlayer, String, double)} instead. */ @Deprecated @@ -238,6 +279,10 @@ public interface Economy { EconomyResponse depositPlayer(OfflinePlayer player, String worldName, double amount); /** + * 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 * @deprecated As of VaultAPI 1.4 use {{@link #createBank(String, OfflinePlayer)} instead. */ @Deprecated @@ -293,6 +338,11 @@ public interface Economy { EconomyResponse bankDeposit(String name, double amount); /** + * Check if a player is the owner of a bank account + * + * @param name of the account + * @param playerName to check for ownership + * @return EconomyResponse Object * @deprecated As of VaultAPI 1.4 use {{@link #isBankOwner(String, OfflinePlayer)} instead. */ @Deprecated @@ -308,6 +358,11 @@ public interface Economy { EconomyResponse isBankOwner(String name, OfflinePlayer player); /** + * Check if the player is a member of the bank account + * + * @param name of the account + * @param playerName to check membership + * @return EconomyResponse Object * @deprecated As of VaultAPI 1.4 use {@link #isBankMember(String, OfflinePlayer)} instead. */ @Deprecated @@ -329,6 +384,9 @@ public interface Economy { List getBanks(); /** + * Attempts to create a player account for the given player + * @param playerName username + * @return if the account creation was successful * @deprecated As of VaultAPI 1.4 use {@link #createPlayerAccount(OfflinePlayer)} instead. */ @Deprecated @@ -342,6 +400,11 @@ public interface Economy { boolean createPlayerAccount(OfflinePlayer player); /** + * 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. + * @param playerName username + * @param worldName String name of the world + * @return if the account creation was successful * @deprecated As of VaultAPI 1.4 use {@link #createPlayerAccount(OfflinePlayer, String)} instead. */ @Deprecated diff --git a/src/main/java/net/milkbowl/vault2/economy/Economy.java b/src/main/java/net/milkbowl/vault2/economy/Economy.java index 947f7b4..3501dd0 100644 --- a/src/main/java/net/milkbowl/vault2/economy/Economy.java +++ b/src/main/java/net/milkbowl/vault2/economy/Economy.java @@ -283,7 +283,7 @@ public interface Economy { /** * A method which changes the name associated with the given UUID in the - * Map received from {@link #getUUIDNameMap()}. + * value returned from {@link #getUUIDNameMap()}. * * @param accountID UUID whose account is having a name change. * @param name String name that will be associated with the UUID in the diff --git a/src/main/java/net/milkbowl/vault2/permission/Permission.java b/src/main/java/net/milkbowl/vault2/permission/Permission.java index d602278..bb27eec 100644 --- a/src/main/java/net/milkbowl/vault2/permission/Permission.java +++ b/src/main/java/net/milkbowl/vault2/permission/Permission.java @@ -53,10 +53,18 @@ public abstract class Permission { abstract public boolean hasSuperPermsCompat(); /** + * Checks if player has a permission node. + * Supports NULL value for World if the permission system registered supports global permissions. + * But May return odd values if the servers registered permission system does not have a global permission store. + * + * @param world String world name + * @param player to check + * @param permission Permission node + * @return Success or Failure * @deprecated As of VaultAPI 1.4 use {@link #playerHas(String, OfflinePlayer, String)} instead. */ @Deprecated - public boolean has(String world, String player, String permission) { + public boolean has(final String world, final String player, final String permission) { if (world == null) { return playerHas((String) null, player, permission); } @@ -64,10 +72,18 @@ public boolean has(String world, String player, String permission) { } /** + * Checks if player has a permission node. + * Supports NULL value for World if the permission system registered supports global permissions. + * But May return odd values if the servers registered permission system does not have a global permission store. + * + * @param world String world name + * @param player to check + * @param permission Permission node + * @return Success or Failure * @deprecated As of VaultAPI 1.4 use {@link #playerHas(String, OfflinePlayer, String)} instead. */ @Deprecated - public boolean has(World world, String player, String permission) { + public boolean has(final World world, final String player, final String permission) { if (world == null) { return playerHas((String) null, player, permission); } @@ -84,7 +100,7 @@ public boolean has(World world, String player, String permission) { * @param permission to check for * @return true if the sender has the permission */ - public boolean has(CommandSender sender, String permission) { + public boolean has(final CommandSender sender, final String permission) { return sender.hasPermission(permission); } @@ -94,21 +110,37 @@ public boolean has(CommandSender sender, String permission) { * @param permission Permission node * @return Success or Failure */ - public boolean has(Player player, String permission) { + public boolean has(final Player player, final String permission) { return player.hasPermission(permission); } /** + * Checks if player has a permission node. + * Supports NULL value for World if the permission system registered supports global permissions. + * But May return odd values if the servers registered permission system does not have a global permission store. + * + * @param world String world name + * @param player to check + * @param permission Permission node + * @return Success or Failure * @deprecated As of VaultAPI 1.4 use {@link #playerHas(String, OfflinePlayer, String)} instead. */ @Deprecated abstract public boolean playerHas(String world, String player, String permission); /** + * Checks if player has a permission node. + * Supports NULL value for World if the permission system registered supports global permissions. + * But May return odd values if the servers registered permission system does not have a global permission store. + * + * @param world String world name + * @param player to check + * @param permission Permission node + * @return Success or Failure * @deprecated As of VaultAPI 1.4 use {@link #playerHas(String, OfflinePlayer, String)} instead. */ @Deprecated - public boolean playerHas(World world, String player, String permission) { + public boolean playerHas(final World world, final String player, final String permission) { if (world == null) { return playerHas((String) null, player, permission); } @@ -125,7 +157,7 @@ public boolean playerHas(World world, String player, String permission) { * @param permission Permission node * @return Success or Failure */ - public boolean playerHas(String world, OfflinePlayer player, String permission) { + public boolean playerHas(final String world, final OfflinePlayer player, final String permission) { if (world == null) { return has((String) null, player.getName(), permission); } @@ -141,7 +173,7 @@ public boolean playerHas(String world, OfflinePlayer player, String permission) * @param permission Permission node * @return Success or Failure */ - public boolean playerHas(Player player, String permission) { + public boolean playerHas(final Player player, final String permission) { return has(player, permission); } @@ -163,7 +195,7 @@ public boolean playerHas(Player player, String permission) { * @deprecated As of VaultAPI 1.4 use {@link #playerAdd(String, OfflinePlayer, String)} instead. */ @Deprecated - public boolean playerAdd(World world, String player, String permission) { + public boolean playerAdd(final World world, final String player, final String permission) { if (world == null) { return playerAdd((String) null, player, permission); } @@ -180,7 +212,7 @@ public boolean playerAdd(World world, String player, String permission) { * @param permission Permission node * @return Success or Failure */ - public boolean playerAdd(String world, OfflinePlayer player, String permission) { + public boolean playerAdd(final String world, final OfflinePlayer player, final String permission) { if (world == null) { return playerAdd((String) null, player.getName(), permission); } @@ -196,7 +228,7 @@ public boolean playerAdd(String world, OfflinePlayer player, String permission) * @param permission Permission node * @return Success or Failure */ - public boolean playerAdd(Player player, String permission) { + public boolean playerAdd(final Player player, final String permission) { return playerAdd(player.getWorld().getName(), player, permission); } @@ -209,7 +241,7 @@ public boolean playerAdd(Player player, String permission) { * @param permission Permission node * @return Success or Failure */ - public boolean playerAddTransient(OfflinePlayer player, String permission) throws UnsupportedOperationException { + public boolean playerAddTransient(final OfflinePlayer player, final String permission) throws UnsupportedOperationException { if (player.isOnline()) { return playerAddTransient((Player) player, permission); } @@ -224,15 +256,15 @@ public boolean playerAddTransient(OfflinePlayer player, String permission) throw * @param permission Permission node * @return Success or Failure */ - public boolean playerAddTransient(Player player, String permission) { - for (PermissionAttachmentInfo paInfo : player.getEffectivePermissions()) { + public boolean playerAddTransient(final Player player, final String permission) { + for (final PermissionAttachmentInfo paInfo : player.getEffectivePermissions()) { if (paInfo.getAttachment() != null && paInfo.getAttachment().getPlugin().equals(plugin)) { paInfo.getAttachment().setPermission(permission, true); return true; } } - PermissionAttachment attach = player.addAttachment(plugin); + final PermissionAttachment attach = player.addAttachment(plugin); attach.setPermission(permission, true); return true; @@ -247,7 +279,7 @@ public boolean playerAddTransient(Player player, String permission) { * @param permission to test * @return Success or Failure */ - public boolean playerAddTransient(String worldName, OfflinePlayer player, String permission) { + public boolean playerAddTransient(final String worldName, final OfflinePlayer player, final String permission) { return playerAddTransient(player, permission); } @@ -260,7 +292,7 @@ public boolean playerAddTransient(String worldName, OfflinePlayer player, String * @param permission to check for * @return Success or Failure */ - public boolean playerAddTransient(String worldName, Player player, String permission) { + public boolean playerAddTransient(final String worldName, final Player player, final String permission) { return playerAddTransient(player, permission); } @@ -273,7 +305,7 @@ public boolean playerAddTransient(String worldName, Player player, String permis * @param permission to remove * @return Success or Failure */ - public boolean playerRemoveTransient(String worldName, OfflinePlayer player, String permission) { + public boolean playerRemoveTransient(final String worldName, final OfflinePlayer player, final String permission) { return playerRemoveTransient(player, permission); } @@ -286,11 +318,19 @@ public boolean playerRemoveTransient(String worldName, OfflinePlayer player, Str * @param permission to check for * @return Success or Failure */ - public boolean playerRemoveTransient(String worldName, Player player, String permission) { + public boolean playerRemoveTransient(final String worldName, final Player player, final String permission) { return playerRemoveTransient((OfflinePlayer) player, permission); } /** + * Checks if player has a permission node. + * Supports NULL value for World if the permission system registered supports global permissions. + * But May return odd values if the servers registered permission system does not have a global permission store. + * + * @param world String world name + * @param player to check + * @param permission Permission node + * @return Success or Failure * @deprecated As of VaultAPI 1.4 use {@link #playerRemove(String, OfflinePlayer, String)} instead. */ @Deprecated @@ -306,7 +346,7 @@ public boolean playerRemoveTransient(String worldName, Player player, String per * @param permission Permission node * @return Success or Failure */ - public boolean playerRemove(String world, OfflinePlayer player, String permission) { + public boolean playerRemove(final String world, final OfflinePlayer player, final String permission) { if (world == null) { return playerRemove((String) null, player.getName(), permission); } @@ -324,7 +364,7 @@ public boolean playerRemove(String world, OfflinePlayer player, String permissio * @return Success or Failure */ @Deprecated - public boolean playerRemove(World world, String player, String permission) { + public boolean playerRemove(final World world, final String player, final String permission) { if (world == null) { return playerRemove((String) null, player, permission); } @@ -339,7 +379,7 @@ public boolean playerRemove(World world, String player, String permission) { * @param permission Permission node * @return Success or Failure */ - public boolean playerRemove(Player player, String permission) { + public boolean playerRemove(final Player player, final String permission) { return playerRemove(player.getWorld().getName(), player, permission); } @@ -354,7 +394,7 @@ public boolean playerRemove(Player player, String permission) { * @param permission Permission node * @return Success or Failure */ - public boolean playerRemoveTransient(OfflinePlayer player, String permission) { + public boolean playerRemoveTransient(final OfflinePlayer player, final String permission) { if (player.isOnline()) { return playerRemoveTransient((Player) player, permission); } else { @@ -369,8 +409,8 @@ public boolean playerRemoveTransient(OfflinePlayer player, String permission) { * @param permission Permission node * @return Success or Failure */ - public boolean playerRemoveTransient(Player player, String permission) { - for (PermissionAttachmentInfo paInfo : player.getEffectivePermissions()) { + public boolean playerRemoveTransient(final Player player, final String permission) { + for (final PermissionAttachmentInfo paInfo : player.getEffectivePermissions()) { if (paInfo.getAttachment() != null && paInfo.getAttachment().getPlugin().equals(plugin)) { paInfo.getAttachment().unsetPermission(permission); return true; @@ -401,7 +441,7 @@ public boolean playerRemoveTransient(Player player, String permission) { * @param permission Permission node * @return Success or Failure */ - public boolean groupHas(World world, String group, String permission) { + public boolean groupHas(final World world, final String group, final String permission) { if (world == null) { return groupHas((String) null, group, permission); } @@ -430,7 +470,7 @@ public boolean groupHas(World world, String group, String permission) { * @param permission Permission node * @return Success or Failure */ - public boolean groupAdd(World world, String group, String permission) { + public boolean groupAdd(final World world, final String group, final String permission) { if (world == null) { return groupAdd((String) null, group, permission); } @@ -459,7 +499,7 @@ public boolean groupAdd(World world, String group, String permission) { * @param permission Permission node * @return Success or Failure */ - public boolean groupRemove(World world, String group, String permission) { + public boolean groupRemove(final World world, final String group, final String permission) { if (world == null) { return groupRemove((String) null, group, permission); } @@ -467,16 +507,30 @@ public boolean groupRemove(World world, String group, String permission) { } /** + * Check if player is member of a group. + * Supports NULL value for World if the permission system registered supports global permissions. + * But May return odd values if the servers registered permission system does not have a global permission store. + * + * @param world World Object + * @param player to check + * @param group Group name * @deprecated As of VaultAPI 1.4 use {@link #playerInGroup(String, OfflinePlayer, String)} instead. */ @Deprecated abstract public boolean playerInGroup(String world, String player, String group); /** + * Check if player is member of a group. + * Supports NULL value for World if the permission system registered supports global permissions. + * But May return odd values if the servers registered permission system does not have a global permission store. + * + * @param world World Object + * @param player to check + * @param group Group name * @deprecated As of VaultAPI 1.4 use {@link #playerInGroup(String, OfflinePlayer, String)} instead. */ @Deprecated - public boolean playerInGroup(World world, String player, String group) { + public boolean playerInGroup(final World world, final String player, final String group) { if (world == null) { return playerInGroup((String) null, player, group); } @@ -493,7 +547,7 @@ public boolean playerInGroup(World world, String player, String group) { * @param group Group name * @return Success or Failure */ - public boolean playerInGroup(String world, OfflinePlayer player, String group) { + public boolean playerInGroup(final String world, final OfflinePlayer player, final String group) { if (world == null) { return playerInGroup((String) null, player.getName(), group); } @@ -509,21 +563,37 @@ public boolean playerInGroup(String world, OfflinePlayer player, String group) { * @param group Group name * @return Success or Failure */ - public boolean playerInGroup(Player player, String group) { + public boolean playerInGroup(final Player player, final String group) { return playerInGroup(player.getWorld().getName(), player, group); } /** + * Add player to a group. + * Supports NULL value for World if the permission system registered supports global permissions. + * But May return odd values if the servers registered permission system does not have a global permission store. + * + * @param world String world name + * @param player to add + * @param group Group name + * @return Success or Failure * @deprecated As of VaultAPI 1.4 use {@link #playerAddGroup(String, OfflinePlayer, String)} instead. */ @Deprecated abstract public boolean playerAddGroup(String world, String player, String group); /** + * Add player to a group. + * Supports NULL value for World if the permission system registered supports global permissions. + * But May return odd values if the servers registered permission system does not have a global permission store. + * + * @param world String world name + * @param player to add + * @param group Group name + * @return Success or Failure * @deprecated As of VaultAPI 1.4 use {@link #playerAddGroup(String, OfflinePlayer, String)} instead. */ @Deprecated - public boolean playerAddGroup(World world, String player, String group) { + public boolean playerAddGroup(final World world, final String player, final String group) { if (world == null) { return playerAddGroup((String) null, player, group); } @@ -540,7 +610,7 @@ public boolean playerAddGroup(World world, String player, String group) { * @param group Group name * @return Success or Failure */ - public boolean playerAddGroup(String world, OfflinePlayer player, String group) { + public boolean playerAddGroup(final String world, final OfflinePlayer player, final String group) { if (world == null) { return playerAddGroup((String) null, player.getName(), group); } @@ -556,21 +626,37 @@ public boolean playerAddGroup(String world, OfflinePlayer player, String group) * @param group Group name * @return Success or Failure */ - public boolean playerAddGroup(Player player, String group) { + public boolean playerAddGroup(final Player player, final String group) { return playerAddGroup(player.getWorld().getName(), player, group); } /** + * Remove player from a group. + * Supports NULL value for World if the permission system registered supports global permissions. + * But May return odd values if the servers registered permission system does not have a global permission store. + * + * @param world World Object + * @param player to remove + * @param group Group name + * @return Success or Failure * @deprecated As of VaultAPI 1.4 use {@link #playerRemoveGroup(String, OfflinePlayer, String)} instead. */ @Deprecated abstract public boolean playerRemoveGroup(String world, String player, String group); /** + * Remove player from a group. + * Supports NULL value for World if the permission system registered supports global permissions. + * But May return odd values if the servers registered permission system does not have a global permission store. + * + * @param world World Object + * @param player to remove + * @param group Group name + * @return Success or Failure * @deprecated As of VaultAPI 1.4 use {@link #playerRemoveGroup(String, OfflinePlayer, String)} instead. */ @Deprecated - public boolean playerRemoveGroup(World world, String player, String group) { + public boolean playerRemoveGroup(final World world, final String player, final String group) { if (world == null) { return playerRemoveGroup((String) null, player, group); } @@ -587,7 +673,7 @@ public boolean playerRemoveGroup(World world, String player, String group) { * @param group Group name * @return Success or Failure */ - public boolean playerRemoveGroup(String world, OfflinePlayer player, String group) { + public boolean playerRemoveGroup(final String world, final OfflinePlayer player, final String group) { if (world == null) { return playerRemoveGroup((String) null, player.getName(), group); } @@ -603,21 +689,35 @@ public boolean playerRemoveGroup(String world, OfflinePlayer player, String grou * @param group Group name * @return Success or Failure */ - public boolean playerRemoveGroup(Player player, String group) { + public boolean playerRemoveGroup(final Player player, final String group) { return playerRemoveGroup(player.getWorld().getName(), player, group); } /** + * Gets the list of groups that this player has + * Supports NULL value for World if the permission system registered supports global permissions. + * But May return odd values if the servers registered permission system does not have a global permission store. + * + * @param world String world name + * @param player OfflinePlayer + * @return Array of groups * @deprecated As of VaultAPI 1.4 use {@link #getPlayerGroups(String, OfflinePlayer)} instead. */ @Deprecated abstract public String[] getPlayerGroups(String world, String player); /** + * Gets the list of groups that this player has + * Supports NULL value for World if the permission system registered supports global permissions. + * But May return odd values if the servers registered permission system does not have a global permission store. + * + * @param world String world name + * @param player OfflinePlayer + * @return Array of groups * @deprecated As of VaultAPI 1.4 use {@link #getPlayerGroups(String, OfflinePlayer)} instead. */ @Deprecated - public String[] getPlayerGroups(World world, String player) { + public String[] getPlayerGroups(final World world, final String player) { if (world == null) { return getPlayerGroups((String) null, player); } @@ -633,7 +733,7 @@ public String[] getPlayerGroups(World world, String player) { * @param player OfflinePlayer * @return Array of groups */ - public String[] getPlayerGroups(String world, OfflinePlayer player) { + public String[] getPlayerGroups(final String world, final OfflinePlayer player) { return getPlayerGroups(world, player.getName()); } @@ -645,21 +745,35 @@ public String[] getPlayerGroups(String world, OfflinePlayer player) { * @param player Player Object * @return Array of groups */ - public String[] getPlayerGroups(Player player) { + public String[] getPlayerGroups(final Player player) { return getPlayerGroups(player.getWorld().getName(), player); } /** + * Gets players primary group + * Supports NULL value for World if the permission system registered supports global permissions. + * But May return odd values if the servers registered permission system does not have a global permission store. + * + * @param world String world name + * @param player to get from + * @return Players primary group * @deprecated As of VaultAPI 1.4 use {@link #getPrimaryGroup(String, OfflinePlayer)} instead. */ @Deprecated abstract public String getPrimaryGroup(String world, String player); /** + * Gets players primary group + * Supports NULL value for World if the permission system registered supports global permissions. + * But May return odd values if the servers registered permission system does not have a global permission store. + * + * @param world String world name + * @param player to get from + * @return Players primary group * @deprecated As of VaultAPI 1.4 use {@link #getPrimaryGroup(String, OfflinePlayer)} instead. */ @Deprecated - public String getPrimaryGroup(World world, String player) { + public String getPrimaryGroup(final World world, final String player) { if (world == null) { return getPrimaryGroup((String) null, player); } @@ -675,7 +789,7 @@ public String getPrimaryGroup(World world, String player) { * @param player to get from * @return Players primary group */ - public String getPrimaryGroup(String world, OfflinePlayer player) { + public String getPrimaryGroup(final String world, final OfflinePlayer player) { return getPrimaryGroup(world, player.getName()); } @@ -687,7 +801,7 @@ public String getPrimaryGroup(String world, OfflinePlayer player) { * @param player Player Object * @return Players primary group */ - public String getPrimaryGroup(Player player) { + public String getPrimaryGroup(final Player player) { return getPrimaryGroup(player.getWorld().getName(), player); } From 99e2bc90d6ec2a5b50d3ca9c1832fc52a0f95be8 Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Fri, 4 Apr 2025 19:57:23 -0400 Subject: [PATCH 63/95] Update javadocs. --- .../milkbowl/vault/permission/Permission.java | 208 ++++++++++++++---- .../vault2/permission/Permission.java | 8 + 2 files changed, 174 insertions(+), 42 deletions(-) diff --git a/src/main/java/net/milkbowl/vault/permission/Permission.java b/src/main/java/net/milkbowl/vault/permission/Permission.java index 608bc6c..8c2d069 100644 --- a/src/main/java/net/milkbowl/vault/permission/Permission.java +++ b/src/main/java/net/milkbowl/vault/permission/Permission.java @@ -54,10 +54,18 @@ public abstract class Permission { abstract public boolean hasSuperPermsCompat(); /** + * Checks if player has a permission node. + * Supports NULL value for World if the permission system registered supports global permissions. + * But May return odd values if the servers registered permission system does not have a global permission store. + * + * @param world String world name + * @param player to check + * @param permission Permission node + * @return Success or Failure * @deprecated As of VaultAPI 1.4 use {@link #playerHas(String, OfflinePlayer, String)} instead. */ @Deprecated - public boolean has(String world, String player, String permission) { + public boolean has(final String world, final String player, final String permission) { if (world == null) { return playerHas((String) null, player, permission); } @@ -65,10 +73,18 @@ public boolean has(String world, String player, String permission) { } /** + * Checks if player has a permission node. + * Supports NULL value for World if the permission system registered supports global permissions. + * But May return odd values if the servers registered permission system does not have a global permission store. + * + * @param world String world name + * @param player to check + * @param permission Permission node + * @return Success or Failure * @deprecated As of VaultAPI 1.4 use {@link #playerHas(String, OfflinePlayer, String)} instead. */ @Deprecated - public boolean has(World world, String player, String permission) { + public boolean has(final World world, final String player, final String permission) { if (world == null) { return playerHas((String) null, player, permission); } @@ -85,7 +101,7 @@ public boolean has(World world, String player, String permission) { * @param permission to check for * @return true if the sender has the permission */ - public boolean has(CommandSender sender, String permission) { + public boolean has(final CommandSender sender, final String permission) { return sender.hasPermission(permission); } @@ -95,21 +111,37 @@ public boolean has(CommandSender sender, String permission) { * @param permission Permission node * @return Success or Failure */ - public boolean has(Player player, String permission) { + public boolean has(final Player player, final String permission) { return player.hasPermission(permission); } /** + * Checks if player has a permission node. + * Supports NULL value for World if the permission system registered supports global permissions. + * But May return odd values if the servers registered permission system does not have a global permission store. + * + * @param world String world name + * @param player to check + * @param permission Permission node + * @return Success or Failure * @deprecated As of VaultAPI 1.4 use {@link #playerHas(String, OfflinePlayer, String)} instead. */ @Deprecated abstract public boolean playerHas(String world, String player, String permission); /** + * Checks if player has a permission node. + * Supports NULL value for World if the permission system registered supports global permissions. + * But May return odd values if the servers registered permission system does not have a global permission store. + * + * @param world String world name + * @param player to check + * @param permission Permission node + * @return Success or Failure * @deprecated As of VaultAPI 1.4 use {@link #playerHas(String, OfflinePlayer, String)} instead. */ @Deprecated - public boolean playerHas(World world, String player, String permission) { + public boolean playerHas(final World world, final String player, final String permission) { if (world == null) { return playerHas((String) null, player, permission); } @@ -126,7 +158,7 @@ public boolean playerHas(World world, String player, String permission) { * @param permission Permission node * @return Success or Failure */ - public boolean playerHas(String world, OfflinePlayer player, String permission) { + public boolean playerHas(final String world, final OfflinePlayer player, final String permission) { if (world == null) { return has((String) null, player.getName(), permission); } @@ -142,7 +174,7 @@ public boolean playerHas(String world, OfflinePlayer player, String permission) * @param permission Permission node * @return Success or Failure */ - public boolean playerHas(Player player, String permission) { + public boolean playerHas(final Player player, final String permission) { return has(player, permission); } @@ -161,10 +193,18 @@ public boolean playerHas(Player player, String permission) { abstract public boolean playerAdd(String world, String player, String permission); /** + * Add permission to a player. + * Supports NULL value for World if the permission system registered supports global permissions. + * But May return odd values if the servers registered permission system does not have a global permission store. + * + * @param world String world name + * @param player to add to + * @param permission Permission node + * @return Success or Failure * @deprecated As of VaultAPI 1.4 use {@link #playerAdd(String, OfflinePlayer, String)} instead. */ @Deprecated - public boolean playerAdd(World world, String player, String permission) { + public boolean playerAdd(final World world, final String player, final String permission) { if (world == null) { return playerAdd((String) null, player, permission); } @@ -181,7 +221,7 @@ public boolean playerAdd(World world, String player, String permission) { * @param permission Permission node * @return Success or Failure */ - public boolean playerAdd(String world, OfflinePlayer player, String permission) { + public boolean playerAdd(final String world, final OfflinePlayer player, final String permission) { if (world == null) { return playerAdd((String) null, player.getName(), permission); } @@ -197,7 +237,7 @@ public boolean playerAdd(String world, OfflinePlayer player, String permission) * @param permission Permission node * @return Success or Failure */ - public boolean playerAdd(Player player, String permission) { + public boolean playerAdd(final Player player, final String permission) { return playerAdd(player.getWorld().getName(), player, permission); } @@ -210,7 +250,7 @@ public boolean playerAdd(Player player, String permission) { * @param permission Permission node * @return Success or Failure */ - public boolean playerAddTransient(OfflinePlayer player, String permission) throws UnsupportedOperationException { + public boolean playerAddTransient(final OfflinePlayer player, final String permission) throws UnsupportedOperationException { if (player.isOnline()) { return playerAddTransient((Player) player, permission); } @@ -225,15 +265,15 @@ public boolean playerAddTransient(OfflinePlayer player, String permission) throw * @param permission Permission node * @return Success or Failure */ - public boolean playerAddTransient(Player player, String permission) { - for (PermissionAttachmentInfo paInfo : player.getEffectivePermissions()) { + public boolean playerAddTransient(final Player player, final String permission) { + for (final PermissionAttachmentInfo paInfo : player.getEffectivePermissions()) { if (paInfo.getAttachment() != null && paInfo.getAttachment().getPlugin().equals(plugin)) { paInfo.getAttachment().setPermission(permission, true); return true; } } - PermissionAttachment attach = player.addAttachment(plugin); + final PermissionAttachment attach = player.addAttachment(plugin); attach.setPermission(permission, true); return true; @@ -248,7 +288,7 @@ public boolean playerAddTransient(Player player, String permission) { * @param permission to test * @return Success or Failure */ - public boolean playerAddTransient(String worldName, OfflinePlayer player, String permission) { + public boolean playerAddTransient(final String worldName, final OfflinePlayer player, final String permission) { return playerAddTransient(player, permission); } @@ -261,7 +301,7 @@ public boolean playerAddTransient(String worldName, OfflinePlayer player, String * @param permission to check for * @return Success or Failure */ - public boolean playerAddTransient(String worldName, Player player, String permission) { + public boolean playerAddTransient(final String worldName, final Player player, final String permission) { return playerAddTransient(player, permission); } @@ -274,7 +314,7 @@ public boolean playerAddTransient(String worldName, Player player, String permis * @param permission to remove * @return Success or Failure */ - public boolean playerRemoveTransient(String worldName, OfflinePlayer player, String permission) { + public boolean playerRemoveTransient(final String worldName, final OfflinePlayer player, final String permission) { return playerRemoveTransient(player, permission); } @@ -287,11 +327,19 @@ public boolean playerRemoveTransient(String worldName, OfflinePlayer player, Str * @param permission to check for * @return Success or Failure */ - public boolean playerRemoveTransient(String worldName, Player player, String permission) { + public boolean playerRemoveTransient(final String worldName, final Player player, final String permission) { return playerRemoveTransient((OfflinePlayer) player, permission); } /** + * Remove permission from a player. + * Supports NULL value for World if the permission system registered supports global permissions. + * But May return odd values if the servers registered permission system does not have a global permission store. + * + * @param world World name + * @param player OfflinePlayer + * @param permission Permission node + * @return Success or Failure * @deprecated As of VaultAPI 1.4 use {@link #playerRemove(String, OfflinePlayer, String)} instead. */ @Deprecated @@ -307,7 +355,7 @@ public boolean playerRemoveTransient(String worldName, Player player, String per * @param permission Permission node * @return Success or Failure */ - public boolean playerRemove(String world, OfflinePlayer player, String permission) { + public boolean playerRemove(final String world, final OfflinePlayer player, final String permission) { if (world == null) { return playerRemove((String) null, player.getName(), permission); } @@ -325,7 +373,7 @@ public boolean playerRemove(String world, OfflinePlayer player, String permissio * @return Success or Failure */ @Deprecated - public boolean playerRemove(World world, String player, String permission) { + public boolean playerRemove(final World world, final String player, final String permission) { if (world == null) { return playerRemove((String) null, player, permission); } @@ -340,7 +388,7 @@ public boolean playerRemove(World world, String player, String permission) { * @param permission Permission node * @return Success or Failure */ - public boolean playerRemove(Player player, String permission) { + public boolean playerRemove(final Player player, final String permission) { return playerRemove(player.getWorld().getName(), player, permission); } @@ -355,7 +403,7 @@ public boolean playerRemove(Player player, String permission) { * @param permission Permission node * @return Success or Failure */ - public boolean playerRemoveTransient(OfflinePlayer player, String permission) { + public boolean playerRemoveTransient(final OfflinePlayer player, final String permission) { if (player.isOnline()) { return playerRemoveTransient((Player) player, permission); } else { @@ -370,8 +418,8 @@ public boolean playerRemoveTransient(OfflinePlayer player, String permission) { * @param permission Permission node * @return Success or Failure */ - public boolean playerRemoveTransient(Player player, String permission) { - for (PermissionAttachmentInfo paInfo : player.getEffectivePermissions()) { + public boolean playerRemoveTransient(final Player player, final String permission) { + for (final PermissionAttachmentInfo paInfo : player.getEffectivePermissions()) { if (paInfo.getAttachment() != null && paInfo.getAttachment().getPlugin().equals(plugin)) { paInfo.getAttachment().unsetPermission(permission); return true; @@ -402,7 +450,7 @@ public boolean playerRemoveTransient(Player player, String permission) { * @param permission Permission node * @return Success or Failure */ - public boolean groupHas(World world, String group, String permission) { + public boolean groupHas(final World world, final String group, final String permission) { if (world == null) { return groupHas((String) null, group, permission); } @@ -431,7 +479,7 @@ public boolean groupHas(World world, String group, String permission) { * @param permission Permission node * @return Success or Failure */ - public boolean groupAdd(World world, String group, String permission) { + public boolean groupAdd(final World world, final String group, final String permission) { if (world == null) { return groupAdd((String) null, group, permission); } @@ -460,7 +508,7 @@ public boolean groupAdd(World world, String group, String permission) { * @param permission Permission node * @return Success or Failure */ - public boolean groupRemove(World world, String group, String permission) { + public boolean groupRemove(final World world, final String group, final String permission) { if (world == null) { return groupRemove((String) null, group, permission); } @@ -468,16 +516,32 @@ public boolean groupRemove(World world, String group, String permission) { } /** + * Check if player is member of a group. + * Supports NULL value for World if the permission system registered supports global permissions. + * But May return odd values if the servers registered permission system does not have a global permission store. + * + * @param world World Object + * @param player to check + * @param group Group name + * @return Success or Failure * @deprecated As of VaultAPI 1.4 use {@link #playerInGroup(String, OfflinePlayer, String)} instead. */ @Deprecated abstract public boolean playerInGroup(String world, String player, String group); /** + * Check if player is member of a group. + * Supports NULL value for World if the permission system registered supports global permissions. + * But May return odd values if the servers registered permission system does not have a global permission store. + * + * @param world World Object + * @param player to check + * @param group Group name + * @return Success or Failure * @deprecated As of VaultAPI 1.4 use {@link #playerInGroup(String, OfflinePlayer, String)} instead. */ @Deprecated - public boolean playerInGroup(World world, String player, String group) { + public boolean playerInGroup(final World world, final String player, final String group) { if (world == null) { return playerInGroup((String) null, player, group); } @@ -494,7 +558,7 @@ public boolean playerInGroup(World world, String player, String group) { * @param group Group name * @return Success or Failure */ - public boolean playerInGroup(String world, OfflinePlayer player, String group) { + public boolean playerInGroup(final String world, final OfflinePlayer player, final String group) { if (world == null) { return playerInGroup((String) null, player.getName(), group); } @@ -510,21 +574,37 @@ public boolean playerInGroup(String world, OfflinePlayer player, String group) { * @param group Group name * @return Success or Failure */ - public boolean playerInGroup(Player player, String group) { + public boolean playerInGroup(final Player player, final String group) { return playerInGroup(player.getWorld().getName(), player, group); } /** + * Add player to a group. + * Supports NULL value for World if the permission system registered supports global permissions. + * But May return odd values if the servers registered permission system does not have a global permission store. + * + * @param world String world name + * @param player to add + * @param group Group name + * @return Success or Failure * @deprecated As of VaultAPI 1.4 use {@link #playerAddGroup(String, OfflinePlayer, String)} instead. */ @Deprecated abstract public boolean playerAddGroup(String world, String player, String group); /** + * Add player to a group. + * Supports NULL value for World if the permission system registered supports global permissions. + * But May return odd values if the servers registered permission system does not have a global permission store. + * + * @param world String world name + * @param player to add + * @param group Group name + * @return Success or Failure * @deprecated As of VaultAPI 1.4 use {@link #playerAddGroup(String, OfflinePlayer, String)} instead. */ @Deprecated - public boolean playerAddGroup(World world, String player, String group) { + public boolean playerAddGroup(final World world, final String player, final String group) { if (world == null) { return playerAddGroup((String) null, player, group); } @@ -541,7 +621,7 @@ public boolean playerAddGroup(World world, String player, String group) { * @param group Group name * @return Success or Failure */ - public boolean playerAddGroup(String world, OfflinePlayer player, String group) { + public boolean playerAddGroup(final String world, final OfflinePlayer player, final String group) { if (world == null) { return playerAddGroup((String) null, player.getName(), group); } @@ -557,21 +637,37 @@ public boolean playerAddGroup(String world, OfflinePlayer player, String group) * @param group Group name * @return Success or Failure */ - public boolean playerAddGroup(Player player, String group) { + public boolean playerAddGroup(final Player player, final String group) { return playerAddGroup(player.getWorld().getName(), player, group); } /** + * Remove player from a group. + * Supports NULL value for World if the permission system registered supports global permissions. + * But May return odd values if the servers registered permission system does not have a global permission store. + * + * @param world World Object + * @param player to remove + * @param group Group name + * @return Success or Failure * @deprecated As of VaultAPI 1.4 use {@link #playerRemoveGroup(String, OfflinePlayer, String)} instead. */ @Deprecated abstract public boolean playerRemoveGroup(String world, String player, String group); /** + * Remove player from a group. + * Supports NULL value for World if the permission system registered supports global permissions. + * But May return odd values if the servers registered permission system does not have a global permission store. + * + * @param world World Object + * @param player to remove + * @param group Group name + * @return Success or Failure * @deprecated As of VaultAPI 1.4 use {@link #playerRemoveGroup(String, OfflinePlayer, String)} instead. */ @Deprecated - public boolean playerRemoveGroup(World world, String player, String group) { + public boolean playerRemoveGroup(final World world, final String player, final String group) { if (world == null) { return playerRemoveGroup((String) null, player, group); } @@ -588,7 +684,7 @@ public boolean playerRemoveGroup(World world, String player, String group) { * @param group Group name * @return Success or Failure */ - public boolean playerRemoveGroup(String world, OfflinePlayer player, String group) { + public boolean playerRemoveGroup(final String world, final OfflinePlayer player, final String group) { if (world == null) { return playerRemoveGroup((String) null, player.getName(), group); } @@ -604,21 +700,35 @@ public boolean playerRemoveGroup(String world, OfflinePlayer player, String grou * @param group Group name * @return Success or Failure */ - public boolean playerRemoveGroup(Player player, String group) { + public boolean playerRemoveGroup(final Player player, final String group) { return playerRemoveGroup(player.getWorld().getName(), player, group); } /** + * Gets the list of groups that this player has + * Supports NULL value for World if the permission system registered supports global permissions. + * But May return odd values if the servers registered permission system does not have a global permission store. + * + * @param world String world name + * @param player OfflinePlayer + * @return Array of groups * @deprecated As of VaultAPI 1.4 use {@link #getPlayerGroups(String, OfflinePlayer)} instead. */ @Deprecated abstract public String[] getPlayerGroups(String world, String player); /** + * Gets the list of groups that this player has + * Supports NULL value for World if the permission system registered supports global permissions. + * But May return odd values if the servers registered permission system does not have a global permission store. + * + * @param world String world name + * @param player OfflinePlayer + * @return Array of groups * @deprecated As of VaultAPI 1.4 use {@link #getPlayerGroups(String, OfflinePlayer)} instead. */ @Deprecated - public String[] getPlayerGroups(World world, String player) { + public String[] getPlayerGroups(final World world, final String player) { if (world == null) { return getPlayerGroups((String) null, player); } @@ -634,7 +744,7 @@ public String[] getPlayerGroups(World world, String player) { * @param player OfflinePlayer * @return Array of groups */ - public String[] getPlayerGroups(String world, OfflinePlayer player) { + public String[] getPlayerGroups(final String world, final OfflinePlayer player) { return getPlayerGroups(world, player.getName()); } @@ -646,21 +756,35 @@ public String[] getPlayerGroups(String world, OfflinePlayer player) { * @param player Player Object * @return Array of groups */ - public String[] getPlayerGroups(Player player) { + public String[] getPlayerGroups(final Player player) { return getPlayerGroups(player.getWorld().getName(), player); } /** + * Gets players primary group + * Supports NULL value for World if the permission system registered supports global permissions. + * But May return odd values if the servers registered permission system does not have a global permission store. + * + * @param world String world name + * @param player to get from + * @return Players primary group * @deprecated As of VaultAPI 1.4 use {@link #getPrimaryGroup(String, OfflinePlayer)} instead. */ @Deprecated abstract public String getPrimaryGroup(String world, String player); /** + * Gets players primary group + * Supports NULL value for World if the permission system registered supports global permissions. + * But May return odd values if the servers registered permission system does not have a global permission store. + * + * @param world String world name + * @param player to get from + * @return Players primary group * @deprecated As of VaultAPI 1.4 use {@link #getPrimaryGroup(String, OfflinePlayer)} instead. */ @Deprecated - public String getPrimaryGroup(World world, String player) { + public String getPrimaryGroup(final World world, final String player) { if (world == null) { return getPrimaryGroup((String) null, player); } @@ -676,7 +800,7 @@ public String getPrimaryGroup(World world, String player) { * @param player to get from * @return Players primary group */ - public String getPrimaryGroup(String world, OfflinePlayer player) { + public String getPrimaryGroup(final String world, final OfflinePlayer player) { return getPrimaryGroup(world, player.getName()); } @@ -688,7 +812,7 @@ public String getPrimaryGroup(String world, OfflinePlayer player) { * @param player Player Object * @return Players primary group */ - public String getPrimaryGroup(Player player) { + public String getPrimaryGroup(final Player player) { return getPrimaryGroup(player.getWorld().getName(), player); } diff --git a/src/main/java/net/milkbowl/vault2/permission/Permission.java b/src/main/java/net/milkbowl/vault2/permission/Permission.java index bb27eec..55f3757 100644 --- a/src/main/java/net/milkbowl/vault2/permission/Permission.java +++ b/src/main/java/net/milkbowl/vault2/permission/Permission.java @@ -192,6 +192,14 @@ public boolean playerHas(final Player player, final String permission) { abstract public boolean playerAdd(String world, String player, String permission); /** + * Add permission to a player. + * Supports NULL value for World if the permission system registered supports global permissions. + * But May return odd values if the servers registered permission system does not have a global permission store. + * + * @param world String world name + * @param player to add to + * @param permission Permission node + * @return Success or Failure * @deprecated As of VaultAPI 1.4 use {@link #playerAdd(String, OfflinePlayer, String)} instead. */ @Deprecated From fbc63e1b9fbc2b04ca1c09284e3c1bf2790a023f Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Fri, 4 Apr 2025 20:01:40 -0400 Subject: [PATCH 64/95] Update javadocs. --- .../java/net/milkbowl/vault/economy/Economy.java | 15 +++++++++++++++ .../java/net/milkbowl/vault2/economy/Economy.java | 3 +-- .../milkbowl/vault2/permission/Permission.java | 2 ++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/milkbowl/vault/economy/Economy.java b/src/main/java/net/milkbowl/vault/economy/Economy.java index 5c22afc..a588d97 100644 --- a/src/main/java/net/milkbowl/vault/economy/Economy.java +++ b/src/main/java/net/milkbowl/vault/economy/Economy.java @@ -85,6 +85,7 @@ public interface Economy { * as all major economy plugins auto-generate a player account when the player joins the server * * @param playerName to check + * @return success true or false * @deprecated As of VaultAPI 1.4 use {@link #hasAccount(OfflinePlayer)} instead. */ @Deprecated @@ -107,6 +108,7 @@ public interface Economy { * * @param playerName to check in the world * @param worldName world-specific account + * @return success true or false * @deprecated As of VaultAPI 1.4 use {@link #hasAccount(OfflinePlayer, String)} instead. */ @Deprecated @@ -182,6 +184,13 @@ public interface Economy { boolean has(OfflinePlayer player, 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. + * + * @param playerName to check + * @param worldName to check with + * @param amount to check for + * @return True if player has amount in the given world, False else wise * @deprecated As of VaultAPI 1.4 use {@link #has(OfflinePlayer, String, double)} instead. */ @Deprecated @@ -219,6 +228,12 @@ public interface Economy { EconomyResponse withdrawPlayer(OfflinePlayer player, 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. + * @param playerName to withdraw from + * @param worldName - name of the world + * @param amount Amount to withdraw + * @return Detailed response of transaction * @deprecated As of VaultAPI 1.4 use {@link #withdrawPlayer(OfflinePlayer, String, double)} instead. */ @Deprecated diff --git a/src/main/java/net/milkbowl/vault2/economy/Economy.java b/src/main/java/net/milkbowl/vault2/economy/Economy.java index 3501dd0..f7df383 100644 --- a/src/main/java/net/milkbowl/vault2/economy/Economy.java +++ b/src/main/java/net/milkbowl/vault2/economy/Economy.java @@ -286,8 +286,7 @@ public interface Economy { * value returned from {@link #getUUIDNameMap()}. * * @param accountID UUID whose account is having a name change. - * @param name String name that will be associated with the UUID in the - * Map map. + * @param name String name that will be associated with the UUID in the map. * @return true if the name change is successful. */ boolean renameAccount(@NotNull final UUID accountID, @NotNull final String name); diff --git a/src/main/java/net/milkbowl/vault2/permission/Permission.java b/src/main/java/net/milkbowl/vault2/permission/Permission.java index 55f3757..df90df9 100644 --- a/src/main/java/net/milkbowl/vault2/permission/Permission.java +++ b/src/main/java/net/milkbowl/vault2/permission/Permission.java @@ -522,6 +522,7 @@ public boolean groupRemove(final World world, final String group, final String p * @param world World Object * @param player to check * @param group Group name + * @return Success or Failure * @deprecated As of VaultAPI 1.4 use {@link #playerInGroup(String, OfflinePlayer, String)} instead. */ @Deprecated @@ -535,6 +536,7 @@ public boolean groupRemove(final World world, final String group, final String p * @param world World Object * @param player to check * @param group Group name + * @return Success or Failure * @deprecated As of VaultAPI 1.4 use {@link #playerInGroup(String, OfflinePlayer, String)} instead. */ @Deprecated From e27b13e7abfd7343d56fdaebd9aeac627c7b6052 Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Fri, 4 Apr 2025 20:04:02 -0400 Subject: [PATCH 65/95] Update release.yml --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 50a0fc6..c5f0487 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -29,6 +29,7 @@ jobs: cd gh-pages git config --local user.email "action@github.com" git config --local user.name "GitHub Action" + git add --all "Update javadoc pages for latest release" git commit -m "Update javadoc pages for latest release" -a - name: Push javadoc changes uses: ad-m/github-push-action@master From 111644cd0800175fa4a4abd4ad9d8ba815e9aa3f Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Fri, 4 Apr 2025 20:09:09 -0400 Subject: [PATCH 66/95] Create javadoc.yml --- .github/workflows/javadoc.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/javadoc.yml diff --git a/.github/workflows/javadoc.yml b/.github/workflows/javadoc.yml new file mode 100644 index 0000000..9b9fe98 --- /dev/null +++ b/.github/workflows/javadoc.yml @@ -0,0 +1,22 @@ +name: Deploy Javadoc + +on: + push: + branches: + - master + - main + +jobs: + publish: + runs-on: ubuntu-latest + permissions: + contents: write # if you have a protection rule on your repository, you'll need to give write permission to the workflow. + steps: + - name: Deploy JavaDoc 🚀 + uses: MathieuSoysal/Javadoc-publisher.yml@v3.0.2 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + javadoc-branch: javadoc + java-version: 8 + target-folder: javadoc # url will be https://.github.io//javadoc, This can be left as nothing to generate javadocs in the root folder. + project: maven From 5f75dadad997a437aecc2e1bc3a4e16930379713 Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Fri, 4 Apr 2025 20:14:34 -0400 Subject: [PATCH 67/95] Update javadocs. --- pom.xml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index 49472f8..df99503 100644 --- a/pom.xml +++ b/pom.xml @@ -123,18 +123,16 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.2.0 + 3.11.2 public - Vault + VaultUnlocked false true true true true - TheNewEconomy, 2024]]> - ${project.build.directory} - javadoc-latest + TheNewEconomy, 2025]]> From d1fcf717185691b267a0b12a818b4f0bf3f01273 Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Fri, 4 Apr 2025 20:16:33 -0400 Subject: [PATCH 68/95] Update javadoc.yml --- .github/workflows/javadoc.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/javadoc.yml b/.github/workflows/javadoc.yml index 9b9fe98..a0fe08b 100644 --- a/.github/workflows/javadoc.yml +++ b/.github/workflows/javadoc.yml @@ -16,7 +16,7 @@ jobs: uses: MathieuSoysal/Javadoc-publisher.yml@v3.0.2 with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - javadoc-branch: javadoc + javadoc-branch: gh-pages java-version: 8 target-folder: javadoc # url will be https://.github.io//javadoc, This can be left as nothing to generate javadocs in the root folder. project: maven From bf5f1a21e1493f8b56958f01e35d9081d543a7f8 Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Fri, 4 Apr 2025 20:22:39 -0400 Subject: [PATCH 69/95] Delete .github/workflows/release.yml --- .github/workflows/release.yml | 40 ----------------------------------- 1 file changed, 40 deletions(-) delete mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index c5f0487..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Publish VaultUnlockedAPI to GitHub Packages -on: - release: - types: [created] -jobs: - publish: - runs-on: ubuntu-latest - steps: - - name: Checkout main branch - uses: actions/checkout@v4 - - name: Checkout gh-pages branch - uses: actions/checkout@v4 - with: - ref: gh-pages - path: gh-pages - - uses: actions/setup-java@v4 - with: - distribution: 'temurin' - java-version: 8 - - name: Build and publish package - env: - GITHUB_TOKEN: ${{ github.token }} - run: | - mvn -B javadoc:javadoc -# mvn -B deploy - - name: Commit javadocs - run: | - cp -Rfv target/javadoc-latest/* gh-pages/ - cd gh-pages - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" - git add --all "Update javadoc pages for latest release" - git commit -m "Update javadoc pages for latest release" -a - - name: Push javadoc changes - uses: ad-m/github-push-action@master - with: - branch: gh-pages - directory: gh-pages - github_token: ${{ github.token }} - From 1bbc0fd58067a648d19135214c294b2324d31b9c Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Fri, 4 Apr 2025 20:27:54 -0400 Subject: [PATCH 70/95] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index eff5fb5..a7137f5 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # VaultUnlockedAPI - Abstraction Library API for Bukkit Plugins - [![Build Status](https://ci.codemc.io/job/creatorfromhell/job/VaultUnlockedAPI/badge/icon)](https://ci.codemc.io/job/creatorfromhell/job/VaultUnlockedAPI/) [![Economy Badge](https://github.com/TheNewEconomy/VaultUnlockedAPI/blob/master/.badge/economy%20badge.png)](https://github.com/TheNewEconomy/VaultUnlockedAPI) +[![Javadoc](https://img.shields.io/badge/JavaDoc-Online-green)](https://theneweconomy.github.io/VaultUnlockedAPI/javadoc/) How to include the API with Maven: ```xml From aac434f6cab59f135e15b9efb95dda7bffab74a9 Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Fri, 4 Apr 2025 20:28:50 -0400 Subject: [PATCH 71/95] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a7137f5..c6b3b73 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -# VaultUnlockedAPI - Abstraction Library API for Bukkit Plugins - [![Build Status](https://ci.codemc.io/job/creatorfromhell/job/VaultUnlockedAPI/badge/icon)](https://ci.codemc.io/job/creatorfromhell/job/VaultUnlockedAPI/) [![Economy Badge](https://github.com/TheNewEconomy/VaultUnlockedAPI/blob/master/.badge/economy%20badge.png)](https://github.com/TheNewEconomy/VaultUnlockedAPI) -[![Javadoc](https://img.shields.io/badge/JavaDoc-Online-green)](https://theneweconomy.github.io/VaultUnlockedAPI/javadoc/) +# VaultUnlockedAPI - Abstraction Library API for Bukkit Plugins - [![Javadoc](https://img.shields.io/badge/JavaDoc-Online-green)](https://theneweconomy.github.io/VaultUnlockedAPI/javadoc/) [![Build Status](https://ci.codemc.io/job/creatorfromhell/job/VaultUnlockedAPI/badge/icon)](https://ci.codemc.io/job/creatorfromhell/job/VaultUnlockedAPI/) [![Economy Badge](https://github.com/TheNewEconomy/VaultUnlockedAPI/blob/master/.badge/economy%20badge.png)](https://github.com/TheNewEconomy/VaultUnlockedAPI) + How to include the API with Maven: ```xml From 983233c6b6e942d85831b189da94986a5c33a59b Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Sun, 1 Jun 2025 00:22:23 -0400 Subject: [PATCH 72/95] Bump version. --- README.md | 4 ++-- pom.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c6b3b73..62c7750 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ How to include the API with Maven: net.milkbowl.vault VaultUnlockedAPI - 2.10 + 2.11 provided @@ -26,7 +26,7 @@ repositories { maven { url 'https://repo.codemc.org/repository/maven-public' } } dependencies { - compileOnly "net.milkbowl.vault:VaultUnlockedAPI:2.9" + compileOnly "net.milkbowl.vault:VaultUnlockedAPI:2.11" } ``` diff --git a/pom.xml b/pom.xml index df99503..71042b5 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 net.milkbowl.vault VaultUnlockedAPI - 2.10 + 2.11 VaultUnlockedAPI From 90ec400bde09c0977510999f3e6a64252f409589 Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Tue, 17 Jun 2025 19:04:22 -0400 Subject: [PATCH 73/95] Bump version. --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 71042b5..6ee998a 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 net.milkbowl.vault VaultUnlockedAPI - 2.11 + 2.12 VaultUnlockedAPI From bb9fd923383c4c2a21f88e84f82723d0577d0471 Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Mon, 30 Jun 2025 21:17:02 -0400 Subject: [PATCH 74/95] Bump version. --- .changelog/2.10.0.md | 5 ++++- pom.xml | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.changelog/2.10.0.md b/.changelog/2.10.0.md index 39d5bd7..d9cbb30 100644 --- a/.changelog/2.10.0.md +++ b/.changelog/2.10.0.md @@ -6,4 +6,7 @@ EconomyResponse set(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final BigDecimal amount); EconomyResponse set(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final String worldName, @NotNull final BigDecimal amount); EconomyResponse set(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final String worldName, @NotNull final String currency, @NotNull final BigDecimal amount); -``` \ No newline at end of file +``` + +# 2.13 +- Added support for 1.21.7 \ No newline at end of file diff --git a/pom.xml b/pom.xml index 6ee998a..a2a7d1f 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 net.milkbowl.vault VaultUnlockedAPI - 2.12 + 2.13 VaultUnlockedAPI From da09248ff6bf0d65ed70ecf5a47de83ce171699f Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Sat, 12 Jul 2025 01:14:45 -0400 Subject: [PATCH 75/95] Bump version, add accountsOwnedBy, accountsMemberOf, accountsAccessTo methods. --- .changelog/2.14.md | 39 +++++++++++++++++ pom.xml | 2 +- .../net/milkbowl/vault2/economy/Economy.java | 42 +++++++++++++++++++ 3 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 .changelog/2.14.md diff --git a/.changelog/2.14.md b/.changelog/2.14.md new file mode 100644 index 0000000..c7a2af2 --- /dev/null +++ b/.changelog/2.14.md @@ -0,0 +1,39 @@ +# 2.13 +- Added a few new methods for grabbing accounts that specific accounts have access to. +```java + + /** + * Retrieves a list of account IDs owned by the specified account ID. + * + * @param pluginName the name of the plugin + * @param accountID the unique identifier of the account + * @return a list of account names owned by the specified account ID + * + * @since 2.14 + */ + List accountsOwnedBy(@NotNull final String pluginName, @NotNull final UUID accountID) + + /** + * Retrieves a list of account IDs that the specified account is a member of. + * + * @param pluginName the name of the plugin + * @param accountID the UUID of the account to check membership for + * @return a List of String values representing the accounts that the account is a member of + * + * @since 2.14 + */ + List accountsMemberOf(@NotNull final String pluginName, @NotNull final UUID accountID) + + /** + * Retrieves a list of account IDs that the specified account has the specified permissions for. + * + * @param pluginName the name of the plugin + * @param accountID the UUID of the account to check access for + * @param permissions variable number of permissions to check for + * @return a list of accounts that the account has the specified permissions to + * + * @since 2.14 + */ + List accountsAccessTo(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final AccountPermission... permissions) + +``` \ No newline at end of file diff --git a/pom.xml b/pom.xml index a2a7d1f..3c06d11 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 net.milkbowl.vault VaultUnlockedAPI - 2.13 + 2.14 VaultUnlockedAPI diff --git a/src/main/java/net/milkbowl/vault2/economy/Economy.java b/src/main/java/net/milkbowl/vault2/economy/Economy.java index f7df383..d351c7b 100644 --- a/src/main/java/net/milkbowl/vault2/economy/Economy.java +++ b/src/main/java/net/milkbowl/vault2/economy/Economy.java @@ -20,7 +20,9 @@ import org.jetbrains.annotations.NotNull; import java.math.BigDecimal; +import java.util.ArrayList; import java.util.Collection; +import java.util.List; import java.util.Map; import java.util.Optional; import java.util.UUID; @@ -648,6 +650,46 @@ default EconomyResponse set(@NotNull final String pluginName, @NotNull final UUI */ boolean createSharedAccount(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final String name, @NotNull final UUID owner); + /** + * Retrieves a list of account IDs owned by the specified account ID. + * + * @param pluginName the name of the plugin + * @param accountID the unique identifier of the account + * @return a list of account names owned by the specified account ID + * + * @since 2.14 + */ + default List accountsOwnedBy(@NotNull final String pluginName, @NotNull final UUID accountID) { + return accountsAccessTo(pluginName, accountID, AccountPermission.OWNER); + } + + /** + * Retrieves a list of account IDs that the specified account is a member of. + * + * @param pluginName the name of the plugin + * @param accountID the UUID of the account to check membership for + * @return a List of String values representing the accounts that the account is a member of + * + * @since 2.14 + */ + default List accountsMemberOf(@NotNull final String pluginName, @NotNull final UUID accountID) { + return accountsAccessTo(pluginName, accountID, AccountPermission.BALANCE, AccountPermission.DEPOSIT, AccountPermission.WITHDRAW); + } + + /** + * Retrieves a list of account IDs that the specified account has the specified permissions for. + * + * @param pluginName the name of the plugin + * @param accountID the UUID of the account to check access for + * @param permissions variable number of permissions to check for + * @return a list of accounts that the account has the specified permissions to + * + * @since 2.14 + */ + default List accountsAccessTo(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final AccountPermission... permissions) { + return new ArrayList<>(); + } + /** * Determines whether the specified owner ID is the owner of the account associated with the given account ID and plugin name. * From 0b6539fd5e44ff9c18c96c3e47e5c33a51d40978 Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Wed, 23 Jul 2025 03:43:03 -0400 Subject: [PATCH 76/95] Update version to 2.15 and changelog for release Bumped project version from 2.14 to 2.15 in `pom.xml`. Added a new changelog file for version 2.15 and corrected a typo in the 2.14 changelog header. --- .changelog/2.14.md | 2 +- .changelog/2.15.md | 2 ++ pom.xml | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 .changelog/2.15.md diff --git a/.changelog/2.14.md b/.changelog/2.14.md index c7a2af2..2a170b9 100644 --- a/.changelog/2.14.md +++ b/.changelog/2.14.md @@ -1,4 +1,4 @@ -# 2.13 +# 2.14 - Added a few new methods for grabbing accounts that specific accounts have access to. ```java diff --git a/.changelog/2.15.md b/.changelog/2.15.md new file mode 100644 index 0000000..7a1109c --- /dev/null +++ b/.changelog/2.15.md @@ -0,0 +1,2 @@ +# 2.15 +- Added support for 1.21.7 \ No newline at end of file diff --git a/pom.xml b/pom.xml index 3c06d11..3310dc3 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 net.milkbowl.vault VaultUnlockedAPI - 2.14 + 2.15 VaultUnlockedAPI From 20af0286a320c99e17a782e65342f40706439690 Mon Sep 17 00:00:00 2001 From: FlagCourier Date: Wed, 30 Jul 2025 11:40:09 -0500 Subject: [PATCH 77/95] Add Gradle to GitIgnore file --- .gitignore | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/.gitignore b/.gitignore index 9686bf3..e5f3421 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,26 @@ /.idea/ /VaultAPI.iml /VaultUnlockedAPI.iml + +## From gitignore/Gradle.gitignore on GitHub +.gradle +**/build/ +!**/src/**/build/ + +# Ignore Gradle GUI config +gradle-app.setting + +# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) +!gradle-wrapper.jar + +# Avoid ignore Gradle wrappper properties +!gradle-wrapper.properties + +# Cache of project +.gradletasknamecache + +# Eclipse Gradle plugin generated files +# Eclipse Core +.project +# JDT-specific (Eclipse Java Development Tools) +.classpath From 324c98112b63c3ac5aa29dabb11b822f0c26a506 Mon Sep 17 00:00:00 2001 From: FlagCourier Date: Wed, 30 Jul 2025 11:40:47 -0500 Subject: [PATCH 78/95] Add initial Gradle files --- build.gradle.kts | 42 ++++ gradle.properties | 4 + gradle/libs.versions.toml | 12 ++ gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 43764 bytes gradle/wrapper/gradle-wrapper.properties | 7 + gradlew | 251 +++++++++++++++++++++++ gradlew.bat | 94 +++++++++ settings.gradle.kts | 1 + 8 files changed, 411 insertions(+) create mode 100644 build.gradle.kts create mode 100644 gradle.properties create mode 100644 gradle/libs.versions.toml create mode 100644 gradle/wrapper/gradle-wrapper.jar create mode 100644 gradle/wrapper/gradle-wrapper.properties create mode 100755 gradlew create mode 100644 gradlew.bat create mode 100644 settings.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..dcae712 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,42 @@ +plugins { + `java-library` + `maven-publish` +} + +repositories { + mavenLocal() + maven { + name = "Spigot" + url = uri("https://hub.spigotmc.org/nexus/content/groups/public/") + } +} + +dependencies { + // See ./gradle/libs.versions.toml + api(libs.org.jetbrains.annotations) + testImplementation(libs.junit.junit) + compileOnly(libs.org.bukkit.bukkit) +} + +group = "net.milkbowl.vault" +version = "2.15" +description = "VaultUnlockedAPI" +java.sourceCompatibility = JavaVersion.VERSION_1_8 + +java { + withSourcesJar() +} + +publishing { + publications.create("maven") { + from(components["java"]) + } +} + +tasks.withType() { + options.encoding = "UTF-8" +} + +tasks.withType() { + options.encoding = "UTF-8" +} diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..dddb525 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,4 @@ +# https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties + +org.gradle.configuration-cache=true + diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..041371c --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,12 @@ +# This file was generated by the Gradle 'init' task. +# https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format + +[versions] +junit-junit = "4.13.1" +org-bukkit-bukkit = "1.13.1-R0.1-SNAPSHOT" +org-jetbrains-annotations = "24.0.0" + +[libraries] +junit-junit = { module = "junit:junit", version.ref = "junit-junit" } +org-bukkit-bukkit = { module = "org.bukkit:bukkit", version.ref = "org-bukkit-bukkit" } +org-jetbrains-annotations = { module = "org.jetbrains:annotations", version.ref = "org-jetbrains-annotations" } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..1b33c55baabb587c669f562ae36f953de2481846 GIT bin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h~sS`C*zbmX?@-crY}E+hy>}2~C0Nn(EKk@5^qO4@l@! z6O0lr%tzGC`D^)8xU3FnMZVm0kX1sBWhaQyzVoXFWwr%Ny?=2M{5s#5i7fTu3gEkG zc{(Pr$v=;`Y#&`y*J}#M9ux>0?xu!`$9cUKm#Bdd_&S#LPTS?ZPV6zN6>W6JTS~-LfjL{mB=b(KMk3 z2HjBSlJeyUVqDd=Mt!=hpYsvby2GL&3~zm;0{^nZJq+4vb?5HH4wufvr}IX42sHeK zm@x?HN$8TsTavXs)tLDFJtY9b)y~Tl@7z4^I8oUQq4JckH@~CVQ;FoK(+e0XAM>1O z(ei}h?)JQp>)d=6ng-BZF1Z5hsAKW@mXq+hU?r8I(*%`tnIIOXw7V6ZK(T9RFJJe@ zZS!aC+p)Gf2Ujc=a6hx4!A1Th%YH!Lb^xpI!Eu` zmJO{9rw){B1Ql18d%F%da+Tbu1()?o(zT7StYqK6_w`e+fjXq5L^y(0 z09QA6H4oFj59c2wR~{~>jUoDzDdKz}5#onYPJRwa`SUO)Pd4)?(ENBaFVLJr6Kvz= zhTtXqbx09C1z~~iZt;g^9_2nCZ{};-b4dQJbv8HsWHXPVg^@(*!@xycp#R?a|L!+` zY5w))JWV`Gls(=}shH0#r*;~>_+-P5Qc978+QUd>J%`fyn{*TsiG-dWMiJXNgwBaT zJ=wgYFt+1ACW)XwtNx)Q9tA2LPoB&DkL16P)ERWQlY4%Y`-5aM9mZ{eKPUgI!~J3Z zkMd5A_p&v?V-o-6TUa8BndiX?ooviev(DKw=*bBVOW|=zps9=Yl|-R5@yJe*BPzN}a0mUsLn{4LfjB_oxpv(mwq# zSY*%E{iB)sNvWfzg-B!R!|+x(Q|b@>{-~cFvdDHA{F2sFGA5QGiIWy#3?P2JIpPKg6ncI^)dvqe`_|N=8 '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH="\\\"\\\"" + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..5eed7ee --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,94 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH= + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 0000000..aeb27bd --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1 @@ +rootProject.name = "VaultUnlockedAPI" \ No newline at end of file From bf42fc0fd1c3b859212b5b8c2b5a568ad8d7ec59 Mon Sep 17 00:00:00 2001 From: FlagCourier Date: Mon, 4 Aug 2025 17:55:58 -0500 Subject: [PATCH 79/95] Establish POM-Parity; Update wrapper to gradle 9.0.0; shorten dep names. - Restructured, moving the group, version, and description towards the top. - Reverted back to Bukkit 1.13.1 (for supposed compatibility) - Reason: Updating this dependency, even to 1.13.2, is outside the scope of the gradle PR. - Swapping to an alternative provider for bukkit is also not my call to make. - Expressly exclude gson, guava, commons-lang, junit, and snakeyaml transitive dependencies. - Combine the 'java {}' declarations, and add withJavadocJar(). Removed vendor restriction on the toolchain. - Add 'pom{}' information to the publishing block. - add 'repositories{}' information to the publishing block. - add options.compilerArgs.add("-parameters") to match Maven's compiler args - add equiv. Javadoc config - gradle-wrapper: Update to gradle 9.0.0 - Toolchain: Use JDK 8 --- build.gradle.kts | 101 ++++++++++++++++++++--- gradle/libs.versions.toml | 12 +-- gradle/wrapper/gradle-wrapper.properties | 2 +- settings.gradle.kts | 7 +- 4 files changed, 104 insertions(+), 18 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index dcae712..d186bf8 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -3,6 +3,10 @@ plugins { `maven-publish` } +group = "net.milkbowl.vault" +version = "2.15" +description = "VaultUnlockedAPI" + repositories { mavenLocal() maven { @@ -12,31 +16,108 @@ repositories { } dependencies { - // See ./gradle/libs.versions.toml - api(libs.org.jetbrains.annotations) - testImplementation(libs.junit.junit) - compileOnly(libs.org.bukkit.bukkit) + // See ./gradle/libs.versions.toml for updating package groups and versions. + + //Runtime + compileOnly(libs.annotations.jetbrains) + compileOnly(libs.bukkit) { + exclude("com.google.code.gson", "gson") + exclude("com.google.guava", "guava") + exclude("commons-lang", "commons-lang") + exclude("junit", "junit") + exclude("org.yaml", "snakeyaml") + } + + //Tests + testImplementation(libs.junit) } -group = "net.milkbowl.vault" -version = "2.15" -description = "VaultUnlockedAPI" -java.sourceCompatibility = JavaVersion.VERSION_1_8 + java { withSourcesJar() + withJavadocJar() + toolchain { + languageVersion = JavaLanguageVersion.of(8) + } } publishing { publications.create("maven") { from(components["java"]) + + pom { + name = rootProject.name + description = "VaultUnlocked is a Permissions & Economy API to allow plugins to more easily hook into" + + " these systems without needing to hook each individual system themselves. " + + "VaultUnlocked supports all plugins that support Vault 1.7" + url = "https://dev.bukkit.org/server-mods/vault/" + organization { + name = "The New Economy" + url = "https://tnemc.net" + } + licenses { + name = "GNU Lesser General Public License, Version 3 (LGPL-3.0)" + url = "https://github.com/TheNewEconomy/VaultUnlockedAPI/blob/master/license.txt" + } + developers { + developer { + id = "creatorfromhell" + name = "Daniel \"creatorfromhell\" Vidmar" + email = "daniel.viddy@gmail.com" + url = "https://cfh.dev" + organization = "The New Economy" + organizationUrl = "https://tnemc.net" + } + } + scm { + connection = "scm:git:git://github.com/TheNewEconomy/VaultUnlockedAPI.git" + developerConnection = "scm:git:git://github.com/TheNewEconomy/VaultUnlockedAPI.git" + url = "https://github.com/TheNewEconomy/VaultUnlockedAPI" + } + issueManagement { + system = "GitHub" + url = "https://github.com/TheNewEconomy/VaultUnlockedAPI/issues" + } + } + } + + repositories { + // Credentials set with environment variables. [Change them how you like them.] + maven { + name = "codemcReleases" + url = uri("https://repo.codemc.io/repository/maven-releases/") + credentials { + username = System.getenv("CODEMC_USER") + password = System.getenv("CODEMC_PASS") + } + } + maven { + name = "codemcSnapshots" + url = uri("https://repo.codemc.io/repository/maven-snapshots/") + credentials { + username = System.getenv("CODEMC_USER") + password = System.getenv("CODEMC_PASS") + } + } } } -tasks.withType() { +tasks.withType { options.encoding = "UTF-8" + options.compilerArgs.add("-parameters") } -tasks.withType() { +tasks.withType { + isFailOnError = false + options.encoding = "UTF-8" + (options as StandardJavadocDocletOptions).apply { + windowTitle = "VaultUnlocked" + isAuthor = true + isVersion = true + links ("https://docs.oracle.com/javase/8/docs/api/", "") + bottom = "TheNewEconomy, 2025" + isNoTimestamp = true + } } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 041371c..1475df5 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -2,11 +2,11 @@ # https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format [versions] -junit-junit = "4.13.1" -org-bukkit-bukkit = "1.13.1-R0.1-SNAPSHOT" -org-jetbrains-annotations = "24.0.0" +junit = "4.13.1" +bukkit = "1.13.1-R0.1-SNAPSHOT" +annotations-jetbrains = "24.0.0" [libraries] -junit-junit = { module = "junit:junit", version.ref = "junit-junit" } -org-bukkit-bukkit = { module = "org.bukkit:bukkit", version.ref = "org-bukkit-bukkit" } -org-jetbrains-annotations = { module = "org.jetbrains:annotations", version.ref = "org-jetbrains-annotations" } +junit = { module = "junit:junit", version.ref = "junit" } +bukkit = { module = "org.bukkit:bukkit", version.ref = "bukkit" } +annotations-jetbrains = { module = "org.jetbrains:annotations", version.ref = "annotations-jetbrains" } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ff23a68..2a84e18 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/settings.gradle.kts b/settings.gradle.kts index aeb27bd..8acdb7a 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1 +1,6 @@ -rootProject.name = "VaultUnlockedAPI" \ No newline at end of file +rootProject.name = "VaultUnlockedAPI" + +plugins { + id("org.gradle.toolchains.foojay-resolver-convention").version("1.0.0") +} + From b84d7fa3b6e8a9a703396f62cba21b74f85a0bed Mon Sep 17 00:00:00 2001 From: FlagCourier Date: Mon, 4 Aug 2025 18:36:02 -0500 Subject: [PATCH 80/95] Apply CodeMC Publishing Changes --- build.gradle.kts | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index d186bf8..238337b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -83,21 +83,17 @@ publishing { } repositories { - // Credentials set with environment variables. [Change them how you like them.] maven { - name = "codemcReleases" - url = uri("https://repo.codemc.io/repository/maven-releases/") - credentials { - username = System.getenv("CODEMC_USER") - password = System.getenv("CODEMC_PASS") - } - } - maven { - name = "codemcSnapshots" - url = uri("https://repo.codemc.io/repository/maven-snapshots/") - credentials { - username = System.getenv("CODEMC_USER") - password = System.getenv("CODEMC_PASS") + name = "CodeMC" + url = uri("https://repo.codemc.io/repository/creatorfromhell/") + + val mavenUsername = System.getenv("GRADLE_PROJECT_MAVEN_USERNAME") + val mavenPassword = System.getenv("GRADLE_PROJECT_MAVEN_PASSWORD") + if (mavenUsername != null && mavenPassword != null) { + credentials { + username = mavenUsername + password = mavenPassword + } } } } From 45d44a47b1995e3d2803d7b335c245126716e62e Mon Sep 17 00:00:00 2001 From: FlagCourier Date: Mon, 4 Aug 2025 18:45:33 -0500 Subject: [PATCH 81/95] Fix Missing "License" block --- build.gradle.kts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 238337b..7aedc67 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -57,8 +57,10 @@ publishing { url = "https://tnemc.net" } licenses { - name = "GNU Lesser General Public License, Version 3 (LGPL-3.0)" - url = "https://github.com/TheNewEconomy/VaultUnlockedAPI/blob/master/license.txt" + license { + name = "GNU Lesser General Public License, Version 3 (LGPL-3.0)" + url = "https://github.com/TheNewEconomy/VaultUnlockedAPI/blob/master/license.txt" + } } developers { developer { From 3417997068a6b58eb1598447c75862ce535e575b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20=22Wega=22=20Weglarz?= <82312488+ThomasWega@users.noreply.github.com> Date: Tue, 5 Aug 2025 14:09:19 +0200 Subject: [PATCH 82/95] Removed usage of @NotNull on primitive type --- src/main/java/net/milkbowl/vault2/economy/Economy.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/net/milkbowl/vault2/economy/Economy.java b/src/main/java/net/milkbowl/vault2/economy/Economy.java index d351c7b..0e828b3 100644 --- a/src/main/java/net/milkbowl/vault2/economy/Economy.java +++ b/src/main/java/net/milkbowl/vault2/economy/Economy.java @@ -79,7 +79,6 @@ public interface Economy { * @return number of digits after the decimal point this plugin supports or -1 * if no rounding occurs. */ - @NotNull int fractionalDigits(@NotNull final String pluginName); /** From 07824e082fe05683e36d01b2fa127c0657e5c935 Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Tue, 5 Aug 2025 13:00:23 -0400 Subject: [PATCH 83/95] Update repository URLs, and CI workflows Updated repository URLs and dependency versions in README.md for consistency and updated the Javadoc workflow to use Gradle instead of Maven. Added a new Gradle CI workflow for building the project and uploading artifacts. --- .github/workflows/gradle.yml | 49 +++++++++++++++++++++++++++++++++++ .github/workflows/javadoc.yml | 19 ++++++++++++-- README.md | 10 +++---- 3 files changed, 71 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/gradle.yml diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml new file mode 100644 index 0000000..93b2f9a --- /dev/null +++ b/.github/workflows/gradle.yml @@ -0,0 +1,49 @@ +# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven + +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +name: Java CI with Gradle + +on: + push: + branches: + - master + - main + + pull_request: + branches: + - master + - main + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - name: Checkout sources + uses: actions/checkout@v4 + + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 21 + cache: gradle + + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v4 + + - name: Build with Gradle + run: ./gradlew build + + - uses: actions/upload-artifact@v4 + with: + name: VaultUnlockedAPI + path: | + **/build/libs/*.jar \ No newline at end of file diff --git a/.github/workflows/javadoc.yml b/.github/workflows/javadoc.yml index a0fe08b..cd916c6 100644 --- a/.github/workflows/javadoc.yml +++ b/.github/workflows/javadoc.yml @@ -11,12 +11,27 @@ jobs: runs-on: ubuntu-latest permissions: contents: write # if you have a protection rule on your repository, you'll need to give write permission to the workflow. + steps: + - name: Checkout sources + uses: actions/checkout@v4 + + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 21 + cache: gradle + + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v4 + - name: Deploy JavaDoc 🚀 uses: MathieuSoysal/Javadoc-publisher.yml@v3.0.2 with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} javadoc-branch: gh-pages - java-version: 8 + java-version: 21 target-folder: javadoc # url will be https://.github.io//javadoc, This can be left as nothing to generate javadocs in the root folder. - project: maven + project: gradle \ No newline at end of file diff --git a/README.md b/README.md index 62c7750..d39d7bc 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,8 @@ How to include the API with Maven: ```xml - codemc-repo - https://repo.codemc.org/repository/maven-public + codemc-creatorfromhell + https://repo.codemc.io/repository/creatorfromhell/ @@ -14,7 +14,7 @@ How to include the API with Maven: net.milkbowl.vault VaultUnlockedAPI - 2.11 + 2.15 provided @@ -23,10 +23,10 @@ How to include the API with Maven: How to include the API with Gradle: ```groovy repositories { - maven { url 'https://repo.codemc.org/repository/maven-public' } + maven { url 'https://repo.codemc.io/repository/creatorfromhell/' } } dependencies { - compileOnly "net.milkbowl.vault:VaultUnlockedAPI:2.11" + compileOnly "net.milkbowl.vault:VaultUnlockedAPI:2.15" } ``` From c04612c69861e1e5efe64b563518e6b8465f87ca Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Wed, 6 Aug 2025 19:23:10 -0400 Subject: [PATCH 84/95] Replace `mavenLocal()` with `mavenCentral()` in `build.gradle.kts` and removed extra newline in `settings.gradle.kts`. --- build.gradle.kts | 2 +- settings.gradle.kts | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 7aedc67..cc3e3f2 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -8,7 +8,7 @@ version = "2.15" description = "VaultUnlockedAPI" repositories { - mavenLocal() + mavenCentral() maven { name = "Spigot" url = uri("https://hub.spigotmc.org/nexus/content/groups/public/") diff --git a/settings.gradle.kts b/settings.gradle.kts index 8acdb7a..cdd2252 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -2,5 +2,4 @@ rootProject.name = "VaultUnlockedAPI" plugins { id("org.gradle.toolchains.foojay-resolver-convention").version("1.0.0") -} - +} \ No newline at end of file From bd77abbcfed17967581a1d3e7107679e7524a3fe Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Wed, 6 Aug 2025 19:31:42 -0400 Subject: [PATCH 85/95] Update plugin URL in `build.gradle.kts` and add overloaded `fractionalDigits` for specifying a currency method in `Economy` interface. Close #24 --- build.gradle.kts | 2 +- .../java/net/milkbowl/vault2/economy/Economy.java | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index cc3e3f2..f53f297 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -51,7 +51,7 @@ publishing { description = "VaultUnlocked is a Permissions & Economy API to allow plugins to more easily hook into" + " these systems without needing to hook each individual system themselves. " + "VaultUnlocked supports all plugins that support Vault 1.7" - url = "https://dev.bukkit.org/server-mods/vault/" + url = "https://modrinth.com/plugin/vaultunlocked" organization { name = "The New Economy" url = "https://tnemc.net" diff --git a/src/main/java/net/milkbowl/vault2/economy/Economy.java b/src/main/java/net/milkbowl/vault2/economy/Economy.java index 0e828b3..2438372 100644 --- a/src/main/java/net/milkbowl/vault2/economy/Economy.java +++ b/src/main/java/net/milkbowl/vault2/economy/Economy.java @@ -81,6 +81,20 @@ public interface Economy { */ int fractionalDigits(@NotNull final String pluginName); + /** + * Retrieves the number of fractional digits for the specified currency associated with the given plugin. This + * function returns the number of digits the plugin keeps or -1 if no rounding + * occurs. + * + * @param pluginName the name of the plugin; must not be null + * @param currency the currency for which the fractional digits are to be retrieved; must not be null + * @return the number of fractional digits for the specified currency or -1 + * if no rounding occurs. + */ + default int fractionalDigits(@NotNull final String pluginName, @NotNull final String currency) { + return fractionalDigits(pluginName); + } + /** * Plugins use this method to format a given BigDecimal amount into a human-readable * amount using your economy plugin's currency names/conventions. From 25f0eba1fd128aae211f34f51c672740b597c3b8 Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Tue, 30 Sep 2025 20:18:53 -0400 Subject: [PATCH 86/95] Update to 1.21.9 --- .changelog/2.16.md | 2 ++ README.md | 4 ++-- pom.xml | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 .changelog/2.16.md diff --git a/.changelog/2.16.md b/.changelog/2.16.md new file mode 100644 index 0000000..a532edc --- /dev/null +++ b/.changelog/2.16.md @@ -0,0 +1,2 @@ +# 2.15 +- Added support for 1.21.9 \ No newline at end of file diff --git a/README.md b/README.md index d39d7bc..74a6bb7 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ How to include the API with Maven: net.milkbowl.vault VaultUnlockedAPI - 2.15 + 2.16 provided @@ -26,7 +26,7 @@ repositories { maven { url 'https://repo.codemc.io/repository/creatorfromhell/' } } dependencies { - compileOnly "net.milkbowl.vault:VaultUnlockedAPI:2.15" + compileOnly "net.milkbowl.vault:VaultUnlockedAPI:2.16" } ``` diff --git a/pom.xml b/pom.xml index 3310dc3..62ee371 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 net.milkbowl.vault VaultUnlockedAPI - 2.15 + 2.16 VaultUnlockedAPI From 2092a52a1574d91f709796c1b0fa041f0fc1b692 Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Tue, 30 Sep 2025 20:26:02 -0400 Subject: [PATCH 87/95] Update gradle build version number. --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index f53f297..fb9f60f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,7 +4,7 @@ plugins { } group = "net.milkbowl.vault" -version = "2.15" +version = "2.16" description = "VaultUnlockedAPI" repositories { From b3d90e48c49bb0e88eda6cdac15a8c31375d6e47 Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Sun, 5 Oct 2025 21:21:21 -0400 Subject: [PATCH 88/95] Update changelog files for work towards 2.17. --- .changelog/2.16.md | 2 +- .changelog/2.17.md | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 .changelog/2.17.md diff --git a/.changelog/2.16.md b/.changelog/2.16.md index a532edc..685e7ff 100644 --- a/.changelog/2.16.md +++ b/.changelog/2.16.md @@ -1,2 +1,2 @@ -# 2.15 +# 2.16 - Added support for 1.21.9 \ No newline at end of file diff --git a/.changelog/2.17.md b/.changelog/2.17.md new file mode 100644 index 0000000..ac17398 --- /dev/null +++ b/.changelog/2.17.md @@ -0,0 +1,2 @@ +# 2.17 +- Added support for 1.21.10 \ No newline at end of file From a28b15db8e0b2568a228efc3b14f7b42f4f12fcb Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Sun, 26 Oct 2025 22:52:42 -0400 Subject: [PATCH 89/95] Update changelog and `Economy` interface for 2.17 - Added detailed clarification in the `Economy` interface documentation regarding default behavior for unsupported features. - Deprecated ambiguous methods returning `List` in favor of new methods returning `List`. - Updated Gradle build version to `2.17`. - Updated changelog for changes in version `2.17`. --- .changelog/2.17.md | 17 +- build.gradle.kts | 2 +- .../net/milkbowl/vault2/economy/Economy.java | 1755 ++++++++++------- 3 files changed, 1037 insertions(+), 737 deletions(-) diff --git a/.changelog/2.17.md b/.changelog/2.17.md index ac17398..dc0cb26 100644 --- a/.changelog/2.17.md +++ b/.changelog/2.17.md @@ -1,2 +1,17 @@ # 2.17 -- Added support for 1.21.10 \ No newline at end of file +- Added support for 1.21.10 +- Added clarity to documentation for default behavior if the provider doesn't support share accounts. +- Added clarity to documentation for default behavior if the provider does not support multi-currency. +- Added clarity to documentation for default behavior if the provider doesn't support multiple worlds. +- Deprecated ```List accountsAccessTo(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final AccountPermission... permissions)``` + - This method will be removed in a future release as the string return allows ambiguity. +- Deprecated ```List accountsMemberOf(@NotNull final String pluginName, @NotNull final UUID accountID)``` + - This method will be removed in a future release as the string return allows ambiguity. +- Deprecated ```List accountsOwnedBy(@NotNull final String pluginName, @NotNull final UUID accountID)``` + - This method will be removed in a future release as the string return allows ambiguity. +- Added ```List accountsWithAccessTo(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final AccountPermission... permissions)``` + - This method is a replacement for the now deprecated ```List accountsAccessTo(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final AccountPermission... permissions)``` +- Added ```List accountsWithMembershipTo(@NotNull final String pluginName, @NotNull final UUID accountID)``` + - This method is a replacement for the now deprecated ```List accountsMemberOf(@NotNull final String pluginName, @NotNull final UUID accountID)``` +- Added ```List accountsWithOwnerOf(@NotNull final String pluginName, @NotNull final UUID accountID)``` + - This method is a replacement for the now deprecated ```List accountsOwnedBy(@NotNull final String pluginName, @NotNull final UUID accountID)``` \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index fb9f60f..665e01a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,7 +4,7 @@ plugins { } group = "net.milkbowl.vault" -version = "2.16" +version = "2.17" description = "VaultUnlockedAPI" repositories { diff --git a/src/main/java/net/milkbowl/vault2/economy/Economy.java b/src/main/java/net/milkbowl/vault2/economy/Economy.java index 2438372..8243cf8 100644 --- a/src/main/java/net/milkbowl/vault2/economy/Economy.java +++ b/src/main/java/net/milkbowl/vault2/economy/Economy.java @@ -22,6 +22,7 @@ import java.math.BigDecimal; import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Optional; @@ -33,758 +34,1042 @@ */ public interface Economy { - /* - * Economy plugin-related methods follow. - */ - - /** - * Checks if economy plugin is enabled. - * - * @return true if the server's economy plugin has properly enabled. - */ - boolean isEnabled(); - - /** - * Gets name of the economy plugin. - * - * @return Name of the active economy plugin on the server. - */ - @NotNull - String getName(); - - /** - * Returns true if the economy plugin supports shared accounts. - * - * @return true if the economy plugin supports shared accounts. - */ - boolean hasSharedAccountSupport(); - - /** - * Returns true if the economy plugin supports multiple currencies. - * - * @return true if the economy plugin supports multiple currencies. - */ - boolean hasMultiCurrencySupport(); - - /* - * 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. - * - * @param pluginName The name of the plugin that is calling the method. - * @return number of digits after the decimal point this plugin supports or -1 - * if no rounding occurs. - */ - int fractionalDigits(@NotNull final String pluginName); - - /** - * Retrieves the number of fractional digits for the specified currency associated with the given plugin. This - * function returns the number of digits the plugin keeps or -1 if no rounding + /* + * Economy plugin-related methods follow. + */ + + /** + * Checks if economy plugin is enabled. + * + * @return true if the server's economy plugin has properly enabled. + */ + boolean isEnabled(); + + /** + * Gets name of the economy plugin. + * + * @return Name of the active economy plugin on the server. + */ + @NotNull + String getName(); + + /** + * Returns true if the economy plugin supports shared accounts. + * + * @return true if the economy plugin supports shared accounts. + */ + boolean hasSharedAccountSupport(); + + /** + * Returns true if the economy plugin supports multiple currencies. + * + * @return true if the economy plugin supports multiple currencies. + */ + boolean hasMultiCurrencySupport(); + + /* + * 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. + * + * @param pluginName The name of the plugin that is calling the method. + * + * @return number of digits after the decimal point this plugin supports or -1 if no rounding + * occurs. + */ + int fractionalDigits(@NotNull final String pluginName); + + /** + * Retrieves the number of fractional digits for the specified currency associated with the given + * plugin. This function returns the number of digits the plugin keeps or -1 if no rounding * occurs. + *

+ * If the provider does not support multi-currency, the provider's default currency will be + * used. + *

+ * @param pluginName the name of the plugin + * @param currency the currency for which the fractional digits are to be retrieved * - * @param pluginName the name of the plugin; must not be null - * @param currency the currency for which the fractional digits are to be retrieved; must not be null - * @return the number of fractional digits for the specified currency or -1 - * if no rounding occurs. + * @return the number of fractional digits for the specified currency or -1 if no rounding occurs. */ - default int fractionalDigits(@NotNull final String pluginName, @NotNull final String currency) { - return fractionalDigits(pluginName); - } + default int fractionalDigits(@NotNull final String pluginName, @NotNull final String currency) { - /** - * Plugins use this method to format a given BigDecimal amount into a human-readable - * amount using your economy plugin's currency names/conventions. - * - * @deprecated This method is deprecated as of version 2.8, and has been replaced by {@link #format(String, BigDecimal)}. - * This allows economy plugins to know exactly if the account is a player or not. This may be removed in a future release. - * - * @param amount to format. - * - * @return Human-readable string describing amount, ie 5 Dollars or 5.55 Pounds. - */ - @NotNull - @Deprecated - String format(@NotNull final BigDecimal amount); - - /** - * Plugins use this method to format a given BigDecimal amount into a human-readable - * amount using your economy plugin's currency names/conventions. - * - * @param pluginName The name of the plugin that is calling the method. - * @param amount to format. - * - * @return Human-readable String describing amount, ie 5 Dollars or 5.55 Pounds. - */ - @NotNull - String format(@NotNull final String pluginName, @NotNull final BigDecimal amount); - - /** - * Plugins use this method to format a given BigDecimal amount into a human-readable - * amount using your economy plugin's currency names/conventions. - * - * @deprecated This method is deprecated as of version 2.8, and has been replaced by {@link #format(String, BigDecimal, String)}. - * This allows economy plugins to know exactly if the account is a player or not. This may be removed in a future release. - * - * @param amount to format. - * @param currency the currency to use for the format. - * - * @return Human-readable string describing amount, ie 5 Dollars or 5.55 Pounds. - */ - @NotNull - @Deprecated - String format(@NotNull final BigDecimal amount, @NotNull final String currency); - - /** - * Plugins use this method to format a given BigDecimal amount into a human-readable - * amount using your economy plugin's currency names/conventions. - * - * @param pluginName The name of the plugin that is calling the method. - * @param amount to format. - * @param currency the currency to use for the format. - * - * @return Human-readable String describing amount, ie 5 Dollars or 5.55 Pounds. - */ - @NotNull - String format(@NotNull final String pluginName, @NotNull final BigDecimal amount, @NotNull final String currency); - - /** - * Returns true if a currency with the specified name exists. - * - * @param currency the currency to use. - * - * @return true if a currency with the specified name exists. - */ - boolean hasCurrency(@NotNull final String currency); - - /** - * Used to get the default currency. This could be the default currency for the server globally or - * for the default world if the implementation supports multi-world. - * - * @param pluginName The name of the plugin that is calling the method. - * @return The currency that is the default for the server if multi-world support is not available - * otherwise the default for the default world. - * - */ - @NotNull - String getDefaultCurrency(@NotNull final String pluginName); - - /** - * Returns the name of the default currency in plural form. If the economy being used - * does not support currency names then an empty string will be returned. - * - * @param pluginName The name of the plugin that is calling the method. - * @return name of the currency (plural) ie: Dollars or Pounds. - */ - @NotNull - String defaultCurrencyNamePlural(@NotNull final String pluginName); - - /** - * Returns the name of the default currency in singular form. If the economy being used - * does not support currency names then an empty string will be returned. - * - * @param pluginName The name of the plugin that is calling the method. - * @return name of the currency (singular) ie: Dollar or Pound. - */ - @NotNull - String defaultCurrencyNameSingular(@NotNull final String pluginName); - - /** - * Returns a list of currencies used by the economy plugin. These are able to be used - * in the calls in the methods of the API. May not be human-readable. - * - * @return list of currencies used by the economy plugin. These are able to be used - * in the calls in the methods of the API. - */ - @NotNull - Collection currencies(); - - /* - * Account-related methods follow. - */ - - /** - * Attempts to create an account for the given UUID. - * - * @deprecated This method is deprecated as of version 2.8, and has been replaced by {@link #createAccount(UUID, String, String, boolean)}. - * This allows economy plugins to know exactly if the account is a player or not. This may be removed in a future release. - * - * @param accountID UUID associated with the account. - * @param name UUID associated with the account. - * @return true if the account creation was successful. - */ - @Deprecated - boolean createAccount(@NotNull final UUID accountID, @NotNull final String name); - - /** - * Creates a new account with the provided information. - * - * @param accountID The UUID of the account to be created. - * @param name The name associated with the account. - * @param player A flag indicating if the account is a player account. - * - * @return true if the account was successfully created, false otherwise. - */ - boolean createAccount(@NotNull final UUID accountID, @NotNull final String name, final boolean player); - - /** - * 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. - * - * @deprecated This method is deprecated as of version 2.8, and has been replaced by {@link #createAccount(UUID, String, String, boolean)}. - * This allows economy plugins to know exactly if the account is a player or not. This may be removed in a future release. - * - * @param accountID UUID associated with the account. - * @param name UUID associated with the account. - * @param worldName String name of the world. - * @return if the account creation was successful - */ - @Deprecated - boolean createAccount(@NotNull final UUID accountID, @NotNull final String name, @NotNull final String worldName); - - /** - * Creates a new account with the given parameters. - * - * @param accountID The UUID of the account to be created. - * @param name The name of the account holder. - * @param worldName The world name associated with the account. - * @param player A boolean indicating if the account belongs to a player. - * - * @return True if the account was successfully created, false otherwise. - */ - boolean createAccount(@NotNull final UUID accountID, @NotNull final String name, @NotNull final String worldName, final boolean player); - - /** - * Returns a map that represents all 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. - */ - @NotNull - Map 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 accountID UUID associated with the account. - * @return An optional containing the last known name if the account exists, otherwise an empty - * optional. - */ - Optional getAccountName(@NotNull final UUID accountID); - - /** - * Checks if this UUID has an account yet. - * - * @param accountID UUID to check for an existing account. - * @return true if the UUID has an account. - */ - boolean hasAccount(@NotNull final UUID accountID); - - /** - * Checks if this UUID has an account yet on the given world. - * - * @param accountID UUID to check for an existing account. - * @param worldName world-specific account. - * @return if the UUID has an account. - */ - boolean hasAccount(@NotNull final UUID accountID, @NotNull final String worldName); - - /** - * A method which changes the name associated with the given UUID in the - * value returned from {@link #getUUIDNameMap()}. - * - * @param accountID UUID whose account is having a name change. - * @param name String name that will be associated with the UUID in the map. - * @return true if the name change is successful. - */ - boolean renameAccount(@NotNull final UUID accountID, @NotNull final String name); - - /** - * Renames the account with the specified ID in the given plugin to the new name. - * - * @param plugin The plugin name where the account exists - * @param accountID The unique identifier of the account to be renamed - * @param name The new name to assign to the account - * - * @return true if the rename operation was successful, false otherwise - */ - boolean renameAccount(@NotNull final String plugin, @NotNull final UUID accountID, @NotNull final String name); - - /** - * Deletes the account associated with the specified UUID. - * - * @param plugin the name of the plugin managing the account - * @param accountID the UUID of the account to be deleted - * @return true if the account was successfully deleted, false otherwise - */ - boolean deleteAccount(@NotNull final String plugin, @NotNull final UUID accountID); - - /* - * Account balance related methods follow. - */ - - /** - * Determines whether an account supports a specific currency. - * - * @param plugin the name of the plugin - * @param accountID the UUID of the account - * @param currency the currency to check support for - * @return true if the account supports the currency, false otherwise - */ - boolean accountSupportsCurrency(@NotNull final String plugin, @NotNull final UUID accountID, @NotNull final String currency); - - /** - * Checks if the given account supports the specified currency in the given world. - * - * @param plugin the name of the plugin requesting the check - * @param accountID the UUID of the player account - * @param currency the currency code to check support for - * @param world the name of the world to check in - * @return true if the account supports the currency in the world, false otherwise - */ - boolean accountSupportsCurrency(@NotNull final String plugin, @NotNull final UUID accountID, @NotNull final String currency, @NotNull final String world); - - /** - * Gets balance of an account associated with a UUID. - * - * @deprecated This method is deprecated as of version 2.9, and has been replaced by {@link #balance(String, UUID)}. - * This allows economy plugins to know exactly if the account is a player or not. This may be removed in a future release. - * - * @param pluginName The name of the plugin that is calling the method. - * @param accountID UUID of the account to get a balance for. - * @return Amount currently held in account associated with the given UUID. - */ - @NotNull - @Deprecated - BigDecimal getBalance(@NotNull final String pluginName, @NotNull final UUID accountID); - - /** - * 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. - * - * @deprecated This method is deprecated as of version 2.9, and has been replaced by {@link #balance(String, UUID, String)}. - * This allows economy plugins to know exactly if the account is a player or not. This may be removed in a future release. - * - * @param pluginName The name of the plugin that is calling the method. - * @param accountID 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. - */ - @NotNull - @Deprecated - BigDecimal getBalance(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final String world); - - /** - * 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. - * - * @deprecated This method is deprecated as of version 2.9, and has been replaced by {@link #balance(String, UUID, String, String)}. - * This allows economy plugins to know exactly if the account is a player or not. This may be removed in a future release. - * - * @param pluginName The name of the plugin that is calling the method. - * @param accountID UUID of the account to get a balance for. - * @param world name of the world. - * @param currency the currency to use. - * @return Amount currently held in account associated with the given UUID. - */ - @NotNull - @Deprecated - BigDecimal getBalance(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final String world, @NotNull final String currency); - - /** - * Gets balance of an account associated with a UUID. - * - * @param pluginName The name of the plugin that is calling the method. - * @param accountID UUID of the account to get a balance for. - * @return Amount currently held in account associated with the given UUID. - */ - @NotNull - default BigDecimal balance(@NotNull final String pluginName, @NotNull final UUID accountID) { - return getBalance(pluginName, accountID); - } + return fractionalDigits(pluginName); + } - /** - * 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 pluginName The name of the plugin that is calling the method. - * @param accountID 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. - */ - @NotNull - default BigDecimal balance(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final String world) { - return getBalance(pluginName, accountID, world); - } + /** + * Plugins use this method to format a given BigDecimal amount into a human-readable amount using + * your economy plugin's currency names/conventions. + * + * @param amount to format. + * + * @return Human-readable string describing amount, ie 5 Dollars or 5.55 Pounds. + * + * @see #fractionalDigits(String) + * @deprecated This method is deprecated as of version 2.8, and has been replaced by + * {@link #format(String, BigDecimal)}. This allows economy plugins to know exactly if the account + * is a player or not. This may be removed in a future release. + */ + @NotNull + @Deprecated + String format(@NotNull final BigDecimal amount); - /** - * 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 pluginName The name of the plugin that is calling the method. - * @param accountID UUID of the account to get a balance for. - * @param world name of the world. - * @param currency the currency to use. - * @return Amount currently held in account associated with the given UUID. - */ - @NotNull - default BigDecimal balance(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final String world, @NotNull final String currency) { - return getBalance(pluginName, accountID, world, currency); - } + /** + * Plugins use this method to format a given BigDecimal amount into a human-readable amount using + * your economy plugin's currency names/conventions. + * + * @param pluginName The name of the plugin that is calling the method. + * @param amount to format. + * + * @return Human-readable String describing amount, ie 5 Dollars or 5.55 Pounds. + * + * @see #fractionalDigits(String) + */ + @NotNull + String format(@NotNull final String pluginName, @NotNull final BigDecimal amount); + + /** + * Plugins use this method to format a given BigDecimal amount into a human-readable amount using + * your economy plugin's currency names/conventions. + *

+ * If the provider does not support multi-currency, the provider's default currency will be + * used. + *

+ * @param amount to format. + * @param currency the currency to use for the format. + * + * @return Human-readable string describing amount, ie 5 Dollars or 5.55 Pounds. + * + * @see #fractionalDigits(String) + * @deprecated This method is deprecated as of version 2.8, and has been replaced by + * {@link #format(String, BigDecimal, String)}. This allows economy plugins to know exactly if the + * account is a player or not. This may be removed in a future release. + */ + @NotNull + @Deprecated + String format(@NotNull final BigDecimal amount, @NotNull final String currency); + + /** + * Plugins use this method to format a given BigDecimal amount into a human-readable amount using + * your economy plugin's currency names/conventions. + *

+ * If the provider does not support multi-currency, the provider's default currency will be + * used. + *

+ * @param pluginName The name of the plugin that is calling the method. + * @param amount to format. + * @param currency the currency to use for the format. + * + * @return Human-readable String describing amount, ie 5 Dollars or 5.55 Pounds. + * + * @see #fractionalDigits(String) + */ + @NotNull + String format(@NotNull final String pluginName, @NotNull final BigDecimal amount, @NotNull final String currency); + + /** + * Returns true if a currency with the specified name exists. + *

+ * If the provider does not support multi-currency, the provider's default currency will be + * used. + *

+ * @param currency the currency to use. + * + * @return true if a currency with the specified name exists. + */ + boolean hasCurrency(@NotNull final String currency); + + /** + * Used to get the default currency. This could be the default currency for the server globally or + * for the default world if the implementation supports multi-world. + *

+ * If the economy being used does not support currency names, then the currency name itself + * should be returned. + *

+ * @param pluginName The name of the plugin that is calling the method. + * + * @return The currency that is the default for the server if multi-world support is not available + * otherwise the default for the default world. + * + */ + @NotNull + String getDefaultCurrency(@NotNull final String pluginName); + + /** + * Returns the name of the default currency in plural form. + *

+ * If the economy being used does not support currency names, then the currency name itself + * should be returned. + *

+ * @param pluginName The name of the plugin that is calling the method. + * + * @return name of the currency (plural) ie: Dollars or Pounds. + */ + @NotNull + String defaultCurrencyNamePlural(@NotNull final String pluginName); + + /** + * Returns the name of the default currency in singular form. + *

+ * If the economy being used does not support currency names, then the currency name itself + * should be returned. + *

+ * @param pluginName The name of the plugin that is calling the method. + * + * @return name of the currency (singular) ie: Dollar or Pound. + */ + @NotNull + String defaultCurrencyNameSingular(@NotNull final String pluginName); + + /** + * Returns a list of currencies used by the economy plugin. These are able to be used in the calls + * in the methods of the API. May not be human-readable. + * + * @return list of currencies used by the economy plugin. These are able to be used in the calls + * in the methods of the API. + */ + @NotNull + Collection currencies(); + + /* + * Account-related methods follow. + */ + /** + * Attempts to create an account for the given UUID. + * + * @param accountID UUID associated with the account. + * @param name the human-readable name to associate with the account. + * + * @return true if the account creation was successful. + * + * @deprecated This method is deprecated as of version 2.8, and has been replaced by + * {@link #createAccount(UUID, String, String, boolean)}. This allows economy plugins to know + * exactly if the account is a player or not. This may be removed in a future release. + */ + @Deprecated + boolean createAccount(@NotNull final UUID accountID, @NotNull final String name); + + /** + * Creates a new account with the provided information. + * + * @param accountID The UUID of the account to be created. + * @param name The name associated with the account. + * @param player A flag indicating if the account is a player account. + * + * @return true if the account was successfully created, false otherwise. + */ + boolean createAccount(@NotNull final UUID accountID, @NotNull final String name, final boolean player); + + /** + * Attempts to create an account for the given UUID on the specified world + *

+ * If the provider does not support multiple worlds, the provider's default world will be used. + *

+ * @param accountID UUID associated with the account. + * @param name the human-readable name to associate with the account. + * @param worldName String name of the world. + * + * @return if the account creation was successful + * + * @deprecated This method is deprecated as of version 2.8, and has been replaced by + * {@link #createAccount(UUID, String, String, boolean)}. This allows economy plugins to know + * exactly if the account is a player or not. This may be removed in a future release. + */ + @Deprecated + boolean createAccount(@NotNull final UUID accountID, @NotNull final String name, @NotNull final String worldName); + + /** + * Creates a new account with the given parameters. + *

+ * If the provider does not support multiple worlds, the provider's default world will be used. + *

+ * @param accountID The UUID of the account to be created. + * @param name The name of the account holder. + * @param worldName The world name associated with the account. + * @param player A boolean indicating if the account belongs to a player. + * + * @return True if the account was successfully created, false otherwise. + */ + boolean createAccount(@NotNull final UUID accountID, @NotNull final String name, @NotNull final String worldName, final boolean player); + + /** + * Returns a map that represents all 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. + */ + @NotNull + Map 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 accountID UUID associated with the account. + * + * @return An optional containing the last-known name if the account exists, otherwise an empty + * optional. + */ + Optional getAccountName(@NotNull final UUID accountID); + + /** + * Checks if this UUID has an account yet. + * + * @param accountID UUID to check for an existing account. + * + * @return true if the UUID has an account. + */ + boolean hasAccount(@NotNull final UUID accountID); + + /** + * Checks if this UUID has an account yet in the given world. + *

+ * If the provider does not support multiple worlds, the provider's default world will be used. + *

+ * @param accountID UUID to check for an existing account. + * @param worldName world-specific account. + * + * @return if the UUID has an account. + */ + boolean hasAccount(@NotNull final UUID accountID, @NotNull final String worldName); + + /** + * A method which changes the name associated with the given UUID in the value returned from + * {@link #getUUIDNameMap()}. + * + * @param accountID UUID whose account is having a name change. + * @param name the human-readable name to associate with the account. + * + * @return true if the name change is successful. + */ + boolean renameAccount(@NotNull final UUID accountID, @NotNull final String name); + + /** + * Renames the account with the specified ID in the given plugin to the new name. + * + * @param plugin The plugin name where the account exists + * @param accountID The unique identifier of the account to be renamed + * @param name The new name to assign to the account + * + * @return true if the rename operation was successful, false otherwise + */ + boolean renameAccount(@NotNull final String plugin, @NotNull final UUID accountID, @NotNull final String name); + + /** + * Deletes the account associated with the specified UUID. + * + * @param plugin the name of the plugin managing the account + * @param accountID the UUID of the account to be deleted + * + * @return true if the account was successfully deleted, false otherwise + */ + boolean deleteAccount(@NotNull final String plugin, @NotNull final UUID accountID); + + /* + * Account balance related methods follow. + */ + + /** + * Determines whether an account supports a specific currency. + *

+ * Note: {@code pluginName} should be used for logging/diagnostics only and MUST NOT affect + * business logic. + *
+ * If the provider does not support multi-currency, the provider's default currency will be + * used. + *

+ * @param plugin the name of the plugin + * @param accountID the UUID of the account + * @param currency the currency to check support for. + * + * @return true if the account supports the currency, false otherwise + */ + boolean accountSupportsCurrency(@NotNull final String plugin, @NotNull final UUID accountID, @NotNull final String currency); + + /** + * Checks if the given account supports the specified currency in the given world. + *

+ * Note: {@code pluginName} should be used for logging/diagnostics only and MUST NOT affect + * business logic. + *
+ * If the provider does not support multiple worlds, the provider's default world will be used. + *
+ * If the provider does not support multi-currency, the provider's default currency will be + * used. + *

+ * @param plugin the name of the plugin requesting the check + * @param accountID the UUID of the player account + * @param currency the currency code to check support for + * @param world the name of the world to check in + * + * @return true if the account supports the currency in the world, false otherwise + */ + boolean accountSupportsCurrency(@NotNull final String plugin, @NotNull final UUID accountID, @NotNull final String currency, @NotNull final String world); + + /** + * Gets balance of an account associated with a UUID. + *

+ * Note: {@code pluginName} should be used for logging/diagnostics only and MUST NOT affect + * business logic. + *

+ * @param pluginName The name of the plugin that is calling the method. This is for logging purposes only. + * @param accountID UUID of the account to get a balance for. + * + * @return Amount currently held in account associated with the given UUID. + * + * @deprecated This method is deprecated as of version 2.9, and has been replaced by + * {@link #balance(String, UUID)}. This allows economy plugins to know exactly if the account is a + * player or not. This may be removed in a future release. + */ + @NotNull + @Deprecated + BigDecimal getBalance(@NotNull final String pluginName, @NotNull final UUID accountID); + + /** + * Gets balance of a UUID on the specified world. + *

+ * Note: {@code pluginName} should be used for logging/diagnostics only and MUST NOT affect + * business logic. + *
+ * If the provider does not support multiple worlds, the provider's default world will be used. + *

+ * @param pluginName The name of the plugin that is calling the method. + * @param accountID 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. + * + * @deprecated This method is deprecated as of version 2.9, and has been replaced by + * {@link #balance(String, UUID, String)}. This allows economy plugins to know exactly if the + * account is a player or not. This may be removed in a future release. + */ + @NotNull + @Deprecated + BigDecimal getBalance(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final String world); + + /** + * Gets balance of a UUID on the specified world and currency. + *

+ * Note: {@code pluginName} should be used for logging/diagnostics only and MUST NOT affect + * business logic. + *
+ * If the provider does not support multiple worlds, the provider's default world will be used. + *
+ * If the provider does not support multi-currency, the provider's default currency will be + * used. + *

+ * @param pluginName The name of the plugin that is calling the method. This is for logging purposes only. + * @param accountID UUID of the account to get a balance for. + * @param world name of the world. + * @param currency the currency to use. + * + * @return Amount currently held in account associated with the given UUID. + * + * @deprecated This method is deprecated as of version 2.9, and has been replaced by + * {@link #balance(String, UUID, String, String)}. This allows economy plugins to know exactly if + * the account is a player or not. This may be removed in a future release. + */ + @NotNull + @Deprecated + BigDecimal getBalance(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final String world, @NotNull final String currency); - /** - * Checks if the account associated with the given UUID has the amount - DO NOT - * USE NEGATIVE AMOUNTS. - * - * @param pluginName The name of the plugin that is calling the method. - * @param accountID the UUID associated with the account to check the balance of. - * @param amount the amount to check for. - * @return True if UUID has amount, False else wise. - */ - boolean has(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final BigDecimal 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 pluginName The name of the plugin that is calling the method. - * @param accountID the UUID associated with the account to check the balance of. - * @param worldName the name of the world to check in. - * @param amount the amount to check for. - * @return True if UUID has amount in the given world, - * False else wise. - */ - boolean has(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final String worldName, @NotNull final BigDecimal 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 pluginName The name of the plugin that is calling the method. - * @param accountID the UUID associated with the account to check the balance of. - * @param worldName the name of the world to check in. - * @param currency the currency to use. - * @param amount the amount to check for. - * @return True if UUID has amount in the given world, - * False else wise. - */ - boolean has(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final String worldName, @NotNull final String currency, @NotNull final BigDecimal amount); - - /** - * - * Sets the amount of monies for a player. - * - * @param pluginName the name of the plugin setting the currency - * @param accountID the unique identifier of the player's account - * @param amount the amount of currency to set for the player in the specified world - * @return an EconomyResponse object indicating the result of the operation - */ - default EconomyResponse set(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final BigDecimal amount) { - - final BigDecimal balance = balance(pluginName, accountID); - final int compare = balance.compareTo(amount); - if(compare > 0) { - return withdraw(pluginName, accountID, balance.subtract(amount)); - } - - if(compare < 0) { - return deposit(pluginName, accountID, amount.subtract(balance)); - } - - return new EconomyResponse(BigDecimal.ZERO, amount, ResponseType.SUCCESS, ""); + /** + * Gets balance of an account associated with a UUID. + *

+ * Note: {@code pluginName} should be used for logging/diagnostics only and MUST NOT affect + * business logic. + *

+ * @param pluginName The name of the plugin that is calling the method. This is for logging purposes only. + * @param accountID UUID of the account to get a balance for. + * + * @return Amount currently held in account associated with the given UUID. + */ + @NotNull + default BigDecimal balance(@NotNull final String pluginName, @NotNull final UUID accountID) { + + return getBalance(pluginName, accountID); + } + + /** + * Gets balance of a UUID on the specified world. + *

+ * Note: {@code pluginName} should be used for logging/diagnostics only and MUST NOT affect + * business logic. + *
+ * If the provider does not support multiple worlds, the provider's default world will be used. + *

+ * @param pluginName The name of the plugin that is calling the method. This is for logging purposes only. + * @param accountID 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. + */ + @NotNull + default BigDecimal balance(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final String world) { + + return getBalance(pluginName, accountID, world); + } + + /** + * Gets balance of a UUID on the specified world and currency. + *

+ * Note: {@code pluginName} should be used for logging/diagnostics only and MUST NOT affect + * business logic. + *
+ * If the provider does not support multiple worlds, the provider's default world will be used. + *
+ * If the provider does not support multi-currency, the provider's default currency will be + * used. + *

+ * @param pluginName The name of the plugin that is calling the method. This is for logging purposes only. + * @param accountID UUID of the account to get a balance for. + * @param world name of the world. + * @param currency the currency to use. + * + * @return Amount currently held in account associated with the given UUID. + */ + @NotNull + default BigDecimal balance(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final String world, @NotNull final String currency) { + + return getBalance(pluginName, accountID, world, currency); + } + + /** + * Checks if the account associated with the given UUID has the amount + *

+ * Note: Negative amounts should not be used. Use deposit methods instead. + *
+ * Note: {@code pluginName} should be used for logging/diagnostics only and MUST NOT affect + * business logic. + *

+ * @param pluginName The name of the plugin that is calling the method. This is for logging purposes only. + * @param accountID the UUID associated with the account to check the balance of. + * @param amount the amount to check for. + * + * @return True if UUID has amount, False else wise. + * + * @see #fractionalDigits(String) + */ + boolean has(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final BigDecimal amount); + + /** + * Checks if the account associated with the given UUID has the amount in the given world + *

+ * Note: Negative amounts should not be used. Use deposit methods instead. + *
+ * Note: {@code pluginName} should be used for logging/diagnostics only and MUST NOT affect + * business logic. + *
+ * If the provider does not support multiple worlds, the provider's default world will be used. + *

+ * @param pluginName The name of the plugin that is calling the method. + * @param accountID the UUID associated with the account to check the balance of. + * @param worldName the name of the world to check in. + * @param amount the amount to check for. + * + * @return True if UUID has amount in the given world, False else wise. + * + * @see #fractionalDigits(String) + */ + boolean has(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final String worldName, @NotNull final BigDecimal amount); + + /** + * Checks if the account associated with the given UUID has the amount in the given world + *

+ * Note: Negative amounts should not be used. Use deposit methods instead. + *
+ * Note: {@code pluginName} should be used for logging/diagnostics only and MUST NOT affect + * business logic. + *
+ * If the provider does not support multiple worlds, the provider's default world will be used. + *
+ * If the provider does not support multi-currency, the provider's default currency will be + * used. + *

+ * @param pluginName The name of the plugin that is calling the method. + * @param accountID the UUID associated with the account to check the balance of. + * @param worldName the name of the world to check in. + * @param currency the currency to use. + * @param amount the amount to check for. + * + * @return True if UUID has amount in the given world, False else wise. + * + * @see #fractionalDigits(String) + */ + boolean has(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final String worldName, @NotNull final String currency, @NotNull final BigDecimal amount); + + /** + * + * Sets the amount of monies for a player. + *

+ * Note: {@code pluginName} should be used for logging/diagnostics only and MUST NOT affect + * business logic. + *

+ * @param pluginName the name of the plugin setting the currency + * @param accountID the unique identifier of the player's account + * @param amount the amount of currency to set for the player in the specified world + * + * @return an EconomyResponse object indicating the result of the operation + */ + default EconomyResponse set(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final BigDecimal amount) { + + final BigDecimal balance = balance(pluginName, accountID); + final int compare = balance.compareTo(amount); + if(compare > 0) { + return withdraw(pluginName, accountID, balance.subtract(amount)); } - /** - * - * Sets the amount of monies for a player in a specific world. - * - * @param pluginName the name of the plugin setting the currency - * @param accountID the unique identifier of the player's account - * @param worldName the name of the world where the currency amount is being set - * @param amount the amount of currency to set for the player in the specified world - * @return an EconomyResponse object indicating the result of the operation - */ - default EconomyResponse set(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final String worldName, @NotNull final BigDecimal amount) { - - final BigDecimal balance = balance(pluginName, accountID, worldName); - final int compare = balance.compareTo(amount); - if(compare > 0) { - return withdraw(pluginName, accountID, worldName, balance.subtract(amount)); - } - - if(compare < 0) { - return deposit(pluginName, accountID, worldName, amount.subtract(balance)); - } - - return new EconomyResponse(BigDecimal.ZERO, amount, ResponseType.SUCCESS, ""); + if(compare < 0) { + return deposit(pluginName, accountID, amount.subtract(balance)); } - /** - * - * Sets the amount of specified currency for a player in a specific world. - * - * @param pluginName the name of the plugin setting the currency - * @param accountID the unique identifier of the player's account - * @param worldName the name of the world where the currency amount is being set - * @param currency the name of the currency being set - * @param amount the amount of currency to set for the player in the specified world - * @return an EconomyResponse object indicating the result of the operation - */ - default EconomyResponse set(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final String worldName, @NotNull final String currency, @NotNull final BigDecimal amount) { - - final BigDecimal balance = balance(pluginName, accountID, worldName, currency); - final int compare = balance.compareTo(amount); - if(compare > 0) { - return withdraw(pluginName, accountID, worldName, currency, balance.subtract(amount)); - } - - if(compare < 0) { - return deposit(pluginName, accountID, worldName, currency, amount.subtract(balance)); - } - - return new EconomyResponse(BigDecimal.ZERO, amount, ResponseType.SUCCESS, ""); + return new EconomyResponse(BigDecimal.ZERO, amount, ResponseType.SUCCESS, ""); + } + + /** + * + * Sets the amount of monies for a player in a specific world. + *

+ * Note: {@code pluginName} should be used for logging/diagnostics only and MUST NOT affect + * business logic. + *
+ * If the provider does not support multiple worlds, the provider's default world will be used. + *

+ * @param pluginName the name of the plugin setting the currency + * @param accountID the unique identifier of the player's account + * @param worldName the name of the world where the currency amount is being set + * @param amount the amount of currency to set for the player in the specified world + * + * @return an EconomyResponse object indicating the result of the operation + */ + default EconomyResponse set(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final String worldName, @NotNull final BigDecimal amount) { + + final BigDecimal balance = balance(pluginName, accountID, worldName); + final int compare = balance.compareTo(amount); + if(compare > 0) { + return withdraw(pluginName, accountID, worldName, balance.subtract(amount)); } - /** - * Withdraw an amount from an account associated with a UUID - DO NOT USE - * NEGATIVE AMOUNTS. - * - * @param pluginName The name of the plugin that is calling the method. - * @param accountID the UUID associated with the account to withdraw from. - * @param amount Amount to withdraw. - * @return {@link EconomyResponse} which includes the Economy plugin's - * {@link ResponseType} as to whether the transaction was a Success, - * Failure, Unsupported. - */ - @NotNull - EconomyResponse withdraw(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final BigDecimal 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 pluginName The name of the plugin that is calling the method. - * @param accountID the UUID associated with the account to withdraw from. - * @param worldName the name of the world to check in. - * @param amount Amount to withdraw. - * @return {@link EconomyResponse} which includes the Economy plugin's - * {@link ResponseType} as to whether the transaction was a Success, - * Failure, Unsupported. - */ - @NotNull - EconomyResponse withdraw(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final String worldName, @NotNull final BigDecimal 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 pluginName The name of the plugin that is calling the method. - * @param accountID the UUID associated with the account to withdraw from. - * @param worldName the name of the world to check in. - * @param currency the currency to use. - * @param amount Amount to withdraw. - * @return {@link EconomyResponse} which includes the Economy plugin's - * {@link ResponseType} as to whether the transaction was a Success, - * Failure, Unsupported. - */ - @NotNull - EconomyResponse withdraw(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final String worldName, @NotNull final String currency, @NotNull final BigDecimal amount); - - /** - * Deposit an amount to an account associated with the given UUID - DO NOT USE - * NEGATIVE AMOUNTS. - * - * @param pluginName The name of the plugin that is calling the method. - * @param accountID the UUID associated with the account to deposit to. - * @param amount Amount to deposit. - * @return {@link EconomyResponse} which includes the Economy plugin's - * {@link ResponseType} as to whether the transaction was a Success, - * Failure, Unsupported. - */ - @NotNull - EconomyResponse deposit(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final BigDecimal amount); - - /** - * Deposit an amount to 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 pluginName The name of the plugin that is calling the method. - * @param accountID the {@link UUID} associated with the account to deposit to. - * @param worldName the name of the world to check in. - * @param amount Amount to deposit. - * @return {@link EconomyResponse} which includes the Economy plugin's - * {@link ResponseType} as to whether the transaction was a Success, - * Failure, Unsupported. - */ - @NotNull - EconomyResponse deposit(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final String worldName, @NotNull final BigDecimal amount); - - /** - * Deposit an amount to 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 pluginName The name of the plugin that is calling the method. - * @param accountID the {@link UUID} associated with the account to deposit to. - * @param worldName the name of the world to check in. - * @param currency the currency to use. - * @param amount Amount to deposit. - * @return {@link EconomyResponse} which includes the Economy plugin's - * {@link ResponseType} as to whether the transaction was a Success, - * Failure, Unsupported. - */ - @NotNull - EconomyResponse deposit(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final String worldName, @NotNull final String currency, @NotNull final BigDecimal amount); - - /* - * Shared Account Methods - */ - - /** - * Creates a shared account with the specified parameters. - * - * @param pluginName the name of the plugin - * @param accountID the {@link UUID} of the account - * @param name the name of the account - * @param owner the {@link UUID} of the account owner - * @return true if the shared account is successfully created, false otherwise - */ - boolean createSharedAccount(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final String name, @NotNull final UUID owner); - - /** - * Retrieves a list of account IDs owned by the specified account ID. - * - * @param pluginName the name of the plugin - * @param accountID the unique identifier of the account - * @return a list of account names owned by the specified account ID - * - * @since 2.14 - */ - default List accountsOwnedBy(@NotNull final String pluginName, @NotNull final UUID accountID) { - return accountsAccessTo(pluginName, accountID, AccountPermission.OWNER); + if(compare < 0) { + return deposit(pluginName, accountID, worldName, amount.subtract(balance)); } - /** - * Retrieves a list of account IDs that the specified account is a member of. - * - * @param pluginName the name of the plugin - * @param accountID the UUID of the account to check membership for - * @return a List of String values representing the accounts that the account is a member of - * - * @since 2.14 - */ - default List accountsMemberOf(@NotNull final String pluginName, @NotNull final UUID accountID) { - return accountsAccessTo(pluginName, accountID, AccountPermission.BALANCE, AccountPermission.DEPOSIT, AccountPermission.WITHDRAW); + return new EconomyResponse(BigDecimal.ZERO, amount, ResponseType.SUCCESS, ""); + } + + /** + * + * Sets the amount of specified currency for a player in a specific world. + *

+ * Note: {@code pluginName} should be used for logging/diagnostics only and MUST NOT affect + * business logic. + *
+ * If the provider does not support multiple worlds, the provider's default world will be used. + *
+ * If the provider does not support multi-currency, the provider's default currency will be + * used. + *

+ * @param pluginName the name of the plugin setting the currency + * @param accountID the unique identifier of the player's account + * @param worldName the name of the world where the currency amount is being set + * @param currency the name of the currency being set + * @param amount the amount of currency to set for the player in the specified world + * + * @return an EconomyResponse object indicating the result of the operation + */ + default EconomyResponse set(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final String worldName, @NotNull final String currency, @NotNull final BigDecimal amount) { + + final BigDecimal balance = balance(pluginName, accountID, worldName, currency); + final int compare = balance.compareTo(amount); + if(compare > 0) { + return withdraw(pluginName, accountID, worldName, currency, balance.subtract(amount)); } - /** - * Retrieves a list of account IDs that the specified account has the specified permissions for. - * - * @param pluginName the name of the plugin - * @param accountID the UUID of the account to check access for - * @param permissions variable number of permissions to check for - * @return a list of accounts that the account has the specified permissions to - * - * @since 2.14 - */ - default List accountsAccessTo(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final AccountPermission... permissions) { - return new ArrayList<>(); + if(compare < 0) { + return deposit(pluginName, accountID, worldName, currency, amount.subtract(balance)); } - /** - * Determines whether the specified owner ID is the owner of the account associated with the given account ID and plugin name. - * - * @param pluginName the name of the plugin - * @param accountID the {@link UUID} of the account - * @param uuid the {@link UUID} to check for ownership of the account - * @return true if the owner ID is the owner of the account, false otherwise - */ - boolean isAccountOwner(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final UUID uuid); - - /** - * Sets the owner of a specified plugin to the given accountID. - * - * @param pluginName The name of the plugin. - * @param accountID The {@link UUID} of the account - * @param uuid The {@link UUID} of the account to set as the owner. - * @return true if the owner is successfully set, false otherwise. - */ - boolean setOwner(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final UUID uuid); - - /** - * Determines whether a specific member is an account member of a given plugin. - * - * @param pluginName The name of the plugin. - * @param accountID The {@link UUID} of the account. - * @param uuid The {@link UUID} to check for membership. - * @return true if the member is an account member, false otherwise. - */ - boolean isAccountMember(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final UUID uuid); - - /** - * Adds a member to an account. - * - * @param pluginName The name of the plugin. - * @param accountID The {@link UUID} of the account. - * @param uuid The {@link UUID} of the member to be added. - * @return true if the member was successfully added, false otherwise. - */ - boolean addAccountMember(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final UUID uuid); - - /** - * Adds a member to an account with the specified initial permissions. - * - * @param pluginName The name of the plugin. - * @param accountID The {@link UUID} of the account. - * @param uuid The {@link UUID} of the member to be added. - * @param initialPermissions The initial permissions to be assigned to the member. The values for - * these should be assumed to be "true." - * @return true if the member was added successfully, false otherwise. - */ - boolean addAccountMember(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final UUID uuid, @NotNull final AccountPermission... initialPermissions); - - /** - * Removes a member from an account. - * - * @param pluginName the name of the plugin managing the account - * @param accountID the {@link UUID} of the account - * @param uuid the {@link UUID} of the member to be removed - * @return true if the member was successfully removed, false otherwise - */ - boolean removeAccountMember(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final UUID uuid); - - /** - * Checks if the specified account has the given permission for the given plugin. - * - * @param pluginName the name of the plugin to check permission for - * @param accountID the {@link UUID} of the account - * @param uuid the {@link UUID} to check for the permission - * @param permission the permission to check for - * @return true if the account has the specified permission, false otherwise - */ - boolean hasAccountPermission(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final UUID uuid, @NotNull final AccountPermission permission); - - /** - * Updates the account permission for a specific plugin and user. - * - * @param pluginName the name of the plugin - * @param accountID the {@link UUID} of the account - * @param uuid the {@link UUID} to update the permission for - * @param permission the new account permissions to set - * @param value the new permission value to set for this value - * @return true if the account permission was successfully updated, false otherwise - */ - boolean updateAccountPermission(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final UUID uuid, @NotNull final AccountPermission permission, final boolean value); + return new EconomyResponse(BigDecimal.ZERO, amount, ResponseType.SUCCESS, ""); + } + + /** + * Withdraw an amount from an account associated with a UUID + *

+ * Note: Negative amounts should not be used. Use deposit methods instead. + *
+ * Note: {@code pluginName} should be used for logging/diagnostics only and MUST NOT affect + * business logic. + *

+ * @param pluginName The name of the plugin that is calling the method. + * @param accountID the UUID associated with the account to withdraw from. + * @param amount Amount to withdraw. + * + * @return {@link EconomyResponse} which includes the Economy plugin's {@link ResponseType} as to + * whether the transaction was a Success, Failure, Unsupported. + * + * @see #fractionalDigits(String) + */ + @NotNull + EconomyResponse withdraw(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final BigDecimal amount); + + /** + * Withdraw an amount from an account associated with a UUID on a given world + *

+ * Note: Negative amounts should not be used. Use deposit methods instead. + *
+ * Note: {@code pluginName} should be used for logging/diagnostics only and MUST NOT affect + * business logic. + *
+ * If the provider does not support multiple worlds, the provider's default world will be used. + *

+ * @param pluginName The name of the plugin that is calling the method. + * @param accountID the UUID associated with the account to withdraw from. + * @param worldName the name of the world to check in. + * @param amount Amount to withdraw. + * + * @return {@link EconomyResponse} which includes the Economy plugin's {@link ResponseType} as to + * whether the transaction was a Success, Failure, Unsupported. + * + * @see #fractionalDigits(String) + */ + @NotNull + EconomyResponse withdraw(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final String worldName, @NotNull final BigDecimal amount); + + /** + * Withdraw an amount from an account associated with a UUID on a given world + *

+ * Note: Negative amounts should not be used. Use deposit methods instead. + *
+ * Note: {@code pluginName} should be used for logging/diagnostics only and MUST NOT affect + * business logic. + *
+ * If the provider does not support multiple worlds, the provider's default world will be used. + *
+ * If the provider does not support multi-currency, the provider's default currency will be + * used. + *

+ * @param pluginName The name of the plugin that is calling the method. + * @param accountID the UUID associated with the account to withdraw from. + * @param worldName the name of the world to check in. + * @param currency the currency to use. + * @param amount Amount to withdraw. + * + * @return {@link EconomyResponse} which includes the Economy plugin's {@link ResponseType} as to + * whether the transaction was a Success, Failure, Unsupported. + * + * @see #fractionalDigits(String) + */ + @NotNull + EconomyResponse withdraw(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final String worldName, @NotNull final String currency, @NotNull final BigDecimal amount); + + /** + * Deposit an amount to an account associated with the given UUID + *

+ * Note: Negative amounts should not be used. Use withdraw methods instead. + *
+ * Note: {@code pluginName} should be used for logging/diagnostics only and MUST NOT affect + * business logic. + *

+ * @param pluginName The name of the plugin that is calling the method. + * @param accountID the UUID associated with the account to deposit to. + * @param amount Amount to deposit. + * + * @return {@link EconomyResponse} which includes the Economy plugin's {@link ResponseType} as to + * whether the transaction was a Success, Failure, Unsupported. + * + * @see #fractionalDigits(String) + */ + @NotNull + EconomyResponse deposit(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final BigDecimal amount); + + /** + * Deposit an amount to an account associated with a UUID on a given world + *

+ * Note: Negative amounts should not be used. Use withdraw methods instead. + *
+ * Note: {@code pluginName} should be used for logging/diagnostics only and MUST NOT affect + * business logic. + *
+ * If the provider does not support multiple worlds, the provider's default world will be used. + *

+ * @param pluginName The name of the plugin that is calling the method. + * @param accountID the {@link UUID} associated with the account to deposit to. + * @param worldName the name of the world to check in. + * @param amount Amount to deposit. + * + * @return {@link EconomyResponse} which includes the Economy plugin's {@link ResponseType} as to + * whether the transaction was a Success, Failure, Unsupported. + * + * @see #fractionalDigits(String) + */ + @NotNull + EconomyResponse deposit(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final String worldName, @NotNull final BigDecimal amount); + + /** + * Deposit an amount to an account associated with a UUID on a given world + *

+ * Note: Negative amounts should not be used. Use withdraw methods instead. + *
+ * Note: {@code pluginName} should be used for logging/diagnostics only and MUST NOT affect + * business logic. + *
+ * If the provider does not support multiple worlds, the provider's default world will be used. + *
+ * If the provider does not support multi-currency, the provider's default currency will be + * used. + *

+ * @param pluginName The name of the plugin that is calling the method. + * @param accountID the {@link UUID} associated with the account to deposit to. + * @param worldName the name of the world to check in. + * @param currency the currency to use. + * @param amount Amount to deposit. + * + * @return {@link EconomyResponse} which includes the Economy plugin's {@link ResponseType} as to + * whether the transaction was a Success, Failure, Unsupported. + * + * @see #fractionalDigits(String) + */ + @NotNull + EconomyResponse deposit(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final String worldName, @NotNull final String currency, @NotNull final BigDecimal amount); + + /* + * Shared Account Methods + */ + + /** + * Creates a shared account with the specified parameters. + *

+ * If the provider does not support shared accounts, this will return false. + *

+ * @param pluginName the name of the plugin + * @param accountID the {@link UUID} of the account + * @param name the name of the account + * @param owner the {@link UUID} of the account owner + * + * @return true if the shared account is successfully created, false otherwise + */ + boolean createSharedAccount(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final String name, @NotNull final UUID owner); + + /** + * Retrieves a list of account IDs owned by the specified account ID. + *

+ * If the provider does not support shared accounts, this will return an unmodifiable empty list. + *

+ * @param pluginName the name of the plugin + * @param accountID the unique identifier of the account + * + * @return a list of account names owned by the specified account ID + * + * @since 2.14 + * @deprecated Use {@link #accountsWithOwnerOf(String, UUID)} instead as the string return allows ambiguity. + */ + default List accountsOwnedBy(@NotNull final String pluginName, @NotNull final UUID accountID) { + + return accountsAccessTo(pluginName, accountID, AccountPermission.OWNER); + } + + /** + * Retrieves a list of account IDs owned by the specified account ID. + *

+ * If the provider does not support shared accounts, this will return an unmodifiable empty list. + *

+ * @param pluginName the name of the plugin + * @param accountID the unique identifier of the account + * + * @return a list of account UUID owned by the specified account ID + * + * @since 2.17 + */ + default List accountsWithOwnerOf(@NotNull final String pluginName, @NotNull final UUID accountID) { + + return accountsWithAccessTo(pluginName, accountID, AccountPermission.OWNER); + } + + /** + * Retrieves a list of account IDs that the specified account is a member of. + *

+ * If the provider does not support shared accounts, this will return an unmodifiable empty list. + *

+ * @param pluginName the name of the plugin + * @param accountID the UUID of the account to check membership for + * + * @return a List of String values representing the accounts that the account is a member of + * + * @since 2.14 + * @deprecated Use {@link #accountsWithMembershipTo(String, UUID)} instead as the string return allows ambiguity. + */ + default List accountsMemberOf(@NotNull final String pluginName, @NotNull final UUID accountID) { + + return accountsAccessTo(pluginName, accountID, AccountPermission.BALANCE, AccountPermission.DEPOSIT, AccountPermission.WITHDRAW); + } + + /** + * Retrieves a list of account IDs that the specified account is a member of. + *

+ * If the provider does not support shared accounts, this will return an unmodifiable empty list. + *

+ * @param pluginName the name of the plugin + * @param accountID the UUID of the account to check membership for + * + * @return a List of UUID values representing the accounts that the account is a member of + * + * @since 2.17 + */ + default List accountsWithMembershipTo(@NotNull final String pluginName, @NotNull final UUID accountID) { + + return accountsWithAccessTo(pluginName, accountID, AccountPermission.BALANCE, AccountPermission.DEPOSIT, AccountPermission.WITHDRAW); + } + + /** + * Retrieves a list of account IDs that the specified account has the specified permissions for. + *

+ * If the provider does not support shared accounts, this will return an unmodifiable empty list. + *

+ * @param pluginName the name of the plugin + * @param accountID the UUID of the account to check access for + * @param permissions variable number of permissions to check for + * + * @return a list of accounts that the account has the specified permissions to + * + * @since 2.14 + * @deprecated Use {@link #accountsWithAccessTo(String, UUID, AccountPermission...)} instead as the string return allows ambiguity. + */ + @Deprecated + default List accountsAccessTo(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final AccountPermission... permissions) { + + return Collections.unmodifiableList(new ArrayList<>()); + } + + /** + * Retrieves a list of account IDs that the specified account has the specified permissions for. + *

+ * If the provider does not support shared accounts, this will return an unmodifiable empty list. + *

+ * @param pluginName the name of the plugin + * @param accountID the UUID of the account to check access for + * @param permissions variable number of permissions to check for + * + * @return a list of accounts that the account has the specified permissions to + * + * @since 2.17 + */ + default List accountsWithAccessTo(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final AccountPermission... permissions) { + + return Collections.unmodifiableList(new ArrayList<>()); + } + + /** + * Determines whether the specified owner ID is the owner of the account associated with the given + * account ID and plugin name. + *

+ * If the provider does not support shared accounts, this will return false. + *

+ * @param pluginName the name of the plugin + * @param accountID the {@link UUID} of the account + * @param uuid the {@link UUID} to check for ownership of the account + * + * @return true if the owner ID is the owner of the account, false otherwise + */ + boolean isAccountOwner(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final UUID uuid); + + /** + * Sets the owner of a specified plugin to the given accountID. + *

+ * If the provider does not support shared accounts, this will return false. + *

+ * @param pluginName The name of the plugin. + * @param accountID The {@link UUID} of the account + * @param uuid The {@link UUID} of the account to set as the owner. + * + * @return true if the owner is successfully set, false otherwise. + */ + boolean setOwner(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final UUID uuid); + + /** + * Determines whether a specific member is an account member of a given plugin. + *

+ * If the provider does not support shared accounts, this will return false. + *

+ * @param pluginName The name of the plugin. + * @param accountID The {@link UUID} of the account. + * @param uuid The {@link UUID} to check for membership. + * + * @return true if the member is an account member, false otherwise. + */ + boolean isAccountMember(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final UUID uuid); + + /** + * Adds a member to an account. + *

+ * If the provider does not support shared accounts, this will return false. + *

+ * @param pluginName The name of the plugin. + * @param accountID The {@link UUID} of the account. + * @param uuid The {@link UUID} of the member to be added. + * + * @return true if the member was successfully added, false otherwise. + */ + boolean addAccountMember(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final UUID uuid); + + /** + * Adds a member to an account with the specified initial permissions. + *

+ * If the provider does not support shared accounts, this will return false. + *

+ * @param pluginName The name of the plugin. + * @param accountID The {@link UUID} of the account. + * @param uuid The {@link UUID} of the member to be added. + * @param initialPermissions The initial permissions to be assigned to the member. The values for + * these should be assumed to be "true." + * + * @return true if the member was added successfully, false otherwise. + */ + boolean addAccountMember(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final UUID uuid, @NotNull final AccountPermission... initialPermissions); + + /** + * Removes a member from an account. + *

+ * If the provider does not support shared accounts, this will return false. + *

+ * @param pluginName the name of the plugin managing the account + * @param accountID the {@link UUID} of the account + * @param uuid the {@link UUID} of the member to be removed + * + * @return true if the member was successfully removed, false otherwise + */ + boolean removeAccountMember(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final UUID uuid); + + /** + * Checks if the specified account has the given permission for the given plugin. + *

+ * If the provider does not support shared accounts, this will return false. + *

+ * @param pluginName the name of the plugin to check permission for + * @param accountID the {@link UUID} of the account + * @param uuid the {@link UUID} to check for the permission + * @param permission the permission to check for + * + * @return true if the account has the specified permission, false otherwise + */ + boolean hasAccountPermission(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final UUID uuid, @NotNull final AccountPermission permission); + + /** + * Updates the account permission for a specific plugin and user. + *

+ * If the provider does not support shared accounts, this will return false. + *

+ * @param pluginName the name of the plugin + * @param accountID the {@link UUID} of the account + * @param uuid the {@link UUID} to update the permission for + * @param permission the new account permissions to set + * @param value the new permission value to set for this value + * + * @return true if the account permission was successfully updated, false otherwise + */ + boolean updateAccountPermission(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final UUID uuid, @NotNull final AccountPermission permission, final boolean value); } From 14d23400cd435abf934416f9b02991993c75475b Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Sun, 23 Nov 2025 20:45:30 -0500 Subject: [PATCH 90/95] Remove `Permission` class from VaultAPI. - Completely removed the `Permission` API implementation, including deprecated methods and transient permission handling. --- .changelog/2.18.md | 4 + .../net/milkbowl/vault2/helper/Context.java | 45 + .../net/milkbowl/vault2/helper/Subject.java | 60 ++ .../net/milkbowl/vault2/helper/TriState.java | 39 + .../vault2/permission/Permission.java | 829 ------------------ .../vault2/permission/PermissionUnlocked.java | 368 ++++++++ 6 files changed, 516 insertions(+), 829 deletions(-) create mode 100644 .changelog/2.18.md create mode 100644 src/main/java/net/milkbowl/vault2/helper/Context.java create mode 100644 src/main/java/net/milkbowl/vault2/helper/Subject.java create mode 100644 src/main/java/net/milkbowl/vault2/helper/TriState.java delete mode 100644 src/main/java/net/milkbowl/vault2/permission/Permission.java create mode 100644 src/main/java/net/milkbowl/vault2/permission/PermissionUnlocked.java diff --git a/.changelog/2.18.md b/.changelog/2.18.md new file mode 100644 index 0000000..5a0935a --- /dev/null +++ b/.changelog/2.18.md @@ -0,0 +1,4 @@ +# 2.18 + +## API Changes +Revamped Permission API to include a modern permission API for VaultUnlocked specifically. \ No newline at end of file diff --git a/src/main/java/net/milkbowl/vault2/helper/Context.java b/src/main/java/net/milkbowl/vault2/helper/Context.java new file mode 100644 index 0000000..215121d --- /dev/null +++ b/src/main/java/net/milkbowl/vault2/helper/Context.java @@ -0,0 +1,45 @@ +package net.milkbowl.vault2.helper; +/* + 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 . + */ + +import org.jetbrains.annotations.Nullable; + +/** + * Represents a context within which certain operations or data are scoped. + * A context can optionally be tied to a specific world. + * + * This class provides functionality to retrieve the name of the world associated + * with this context, or operate within a global, world-less context if no specific + * world is supplied. + * @author creatorfromhell + * @since 2.18 + */ +public class Context { + + public static final Context GLOBAL = new Context(null); + + private String world; + + public Context(@Nullable final String world) { + this.world = world; + } + + @Nullable + public String world() { + return world; + } +} \ No newline at end of file diff --git a/src/main/java/net/milkbowl/vault2/helper/Subject.java b/src/main/java/net/milkbowl/vault2/helper/Subject.java new file mode 100644 index 0000000..af186ce --- /dev/null +++ b/src/main/java/net/milkbowl/vault2/helper/Subject.java @@ -0,0 +1,60 @@ +package net.milkbowl.vault2.helper; +/* + 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 . + */ + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.UUID; + +/** + * Represents a subject with a unique identifier, a name, and a flag indicating + * whether the subject is a player. + * + * This class provides methods to retrieve the subject's identifier and name, + * with additional metadata annotations to indicate nullability. + * + * @author creatorfromhell + * @since 2.18 + */ +public class Subject { + + private UUID identifier; + private String name; + private boolean player; + + public Subject(final UUID identifier, final String name, final boolean player) { + + this.identifier = identifier; + this.name = name; + this.player = player; + } + + @NotNull + public UUID identifier() { + return identifier; + } + + @Nullable + public String name() { + return name; + } + + public boolean isPlayer() { + return player; + } +} \ No newline at end of file diff --git a/src/main/java/net/milkbowl/vault2/helper/TriState.java b/src/main/java/net/milkbowl/vault2/helper/TriState.java new file mode 100644 index 0000000..921daa2 --- /dev/null +++ b/src/main/java/net/milkbowl/vault2/helper/TriState.java @@ -0,0 +1,39 @@ +package net.milkbowl.vault2.helper; +/* + 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 . + */ + +/** + * Represents a tri-state value that can be TRUE, FALSE, or UNDEFINED. + * + * This enum provides a way to manage and interpret values where a third, + * undefined state is necessary beyond binary truth values. The method + * asBool() allows for interpreting the TRUE state as a boolean true while + * treating all other states (FALSE and UNDEFINED) as boolean false. + * + * @author creatorfromhell + * @since 2.18 + */ +public enum TriState { + + TRUE, + FALSE, + UNDEFINED; + + public boolean asBool() { + return this == TRUE; + } +} \ No newline at end of file diff --git a/src/main/java/net/milkbowl/vault2/permission/Permission.java b/src/main/java/net/milkbowl/vault2/permission/Permission.java deleted file mode 100644 index df90df9..0000000 --- a/src/main/java/net/milkbowl/vault2/permission/Permission.java +++ /dev/null @@ -1,829 +0,0 @@ -/* 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 . - */ -package net.milkbowl.vault2.permission; - -import java.util.logging.Logger; - -import org.bukkit.OfflinePlayer; -import org.bukkit.World; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; -import org.bukkit.permissions.PermissionAttachment; -import org.bukkit.permissions.PermissionAttachmentInfo; -import org.bukkit.plugin.Plugin; - -/** - * The main Permission API - allows for group and player based permission tests - * - */ -public abstract class Permission { - - protected static final Logger log = Logger.getLogger("Minecraft"); - protected Plugin plugin = null; - - /** - * Gets name of permission method - * @return Name of Permission Method - */ - abstract public String getName(); - - /** - * Checks if permission method is enabled. - * @return Success or Failure - */ - abstract public boolean isEnabled(); - - /** - * Returns if the permission system is or attempts to be compatible with super-perms. - * @return True if this permission implementation works with super-perms - */ - abstract public boolean hasSuperPermsCompat(); - - /** - * Checks if player has a permission node. - * Supports NULL value for World if the permission system registered supports global permissions. - * But May return odd values if the servers registered permission system does not have a global permission store. - * - * @param world String world name - * @param player to check - * @param permission Permission node - * @return Success or Failure - * @deprecated As of VaultAPI 1.4 use {@link #playerHas(String, OfflinePlayer, String)} instead. - */ - @Deprecated - public boolean has(final String world, final String player, final String permission) { - if (world == null) { - return playerHas((String) null, player, permission); - } - return playerHas(world, player, permission); - } - - /** - * Checks if player has a permission node. - * Supports NULL value for World if the permission system registered supports global permissions. - * But May return odd values if the servers registered permission system does not have a global permission store. - * - * @param world String world name - * @param player to check - * @param permission Permission node - * @return Success or Failure - * @deprecated As of VaultAPI 1.4 use {@link #playerHas(String, OfflinePlayer, String)} instead. - */ - @Deprecated - public boolean has(final World world, final String player, final String permission) { - if (world == null) { - return playerHas((String) null, player, permission); - } - return playerHas(world.getName(), player, permission); - } - - /** - * Checks if a CommandSender has a permission node. - * This will return the result of bukkits, generic .hasPermission() method and is identical in all cases. - * This method will explicitly fail if the registered permission system does not register permissions in bukkit. - * - * For easy checking of a commandsender - * @param sender to check permissions on - * @param permission to check for - * @return true if the sender has the permission - */ - public boolean has(final CommandSender sender, final String permission) { - return sender.hasPermission(permission); - } - - /** - * Checks if player has a permission node. (Short for playerHas(...) - * @param player Player Object - * @param permission Permission node - * @return Success or Failure - */ - public boolean has(final Player player, final String permission) { - return player.hasPermission(permission); - } - - /** - * Checks if player has a permission node. - * Supports NULL value for World if the permission system registered supports global permissions. - * But May return odd values if the servers registered permission system does not have a global permission store. - * - * @param world String world name - * @param player to check - * @param permission Permission node - * @return Success or Failure - * @deprecated As of VaultAPI 1.4 use {@link #playerHas(String, OfflinePlayer, String)} instead. - */ - @Deprecated - abstract public boolean playerHas(String world, String player, String permission); - - /** - * Checks if player has a permission node. - * Supports NULL value for World if the permission system registered supports global permissions. - * But May return odd values if the servers registered permission system does not have a global permission store. - * - * @param world String world name - * @param player to check - * @param permission Permission node - * @return Success or Failure - * @deprecated As of VaultAPI 1.4 use {@link #playerHas(String, OfflinePlayer, String)} instead. - */ - @Deprecated - public boolean playerHas(final World world, final String player, final String permission) { - if (world == null) { - return playerHas((String) null, player, permission); - } - return playerHas(world.getName(), player, permission); - } - - /** - * Checks if player has a permission node. - * Supports NULL value for World if the permission system registered supports global permissions. - * But May return odd values if the servers registered permission system does not have a global permission store. - * - * @param world String world name - * @param player to check - * @param permission Permission node - * @return Success or Failure - */ - public boolean playerHas(final String world, final OfflinePlayer player, final String permission) { - if (world == null) { - return has((String) null, player.getName(), permission); - } - return has(world, player.getName(), permission); - } - - /** - * Checks if player has a permission node. - * Defaults to world-specific permission check if the permission system supports it. - * See {@link #playerHas(String, OfflinePlayer, String)} for explicit global or world checks. - * - * @param player Player Object - * @param permission Permission node - * @return Success or Failure - */ - public boolean playerHas(final Player player, final String permission) { - return has(player, permission); - } - - /** - * @deprecated As of VaultAPI 1.4 use {@link #playerAdd(String, OfflinePlayer, String)} instead. - * Add permission to a player. - * Supports NULL value for World if the permission system registered supports global permissions. - * But May return odd values if the servers registered permission system does not have a global permission store. - * - * @param world World name - * @param player Player name - * @param permission Permission node - * @return Success or Failure - */ - @Deprecated - abstract public boolean playerAdd(String world, String player, String permission); - - /** - * Add permission to a player. - * Supports NULL value for World if the permission system registered supports global permissions. - * But May return odd values if the servers registered permission system does not have a global permission store. - * - * @param world String world name - * @param player to add to - * @param permission Permission node - * @return Success or Failure - * @deprecated As of VaultAPI 1.4 use {@link #playerAdd(String, OfflinePlayer, String)} instead. - */ - @Deprecated - public boolean playerAdd(final World world, final String player, final String permission) { - if (world == null) { - return playerAdd((String) null, player, permission); - } - return playerAdd(world.getName(), player, permission); - } - - /** - * Add permission to a player. - * Supports NULL value for World if the permission system registered supports global permissions. - * But May return odd values if the servers registered permission system does not have a global permission store. - * - * @param world String world name - * @param player to add to - * @param permission Permission node - * @return Success or Failure - */ - public boolean playerAdd(final String world, final OfflinePlayer player, final String permission) { - if (world == null) { - return playerAdd((String) null, player.getName(), permission); - } - return playerAdd(world, player.getName(), permission); - } - - /** - * Add permission to a player ONLY for the world the player is currently on. - * This is a world-specific operation, if you want to add global permission you must explicitly use NULL for the world. - * See {@link #playerAdd(String, OfflinePlayer, String)} for global permission use. - * - * @param player Player Object - * @param permission Permission node - * @return Success or Failure - */ - public boolean playerAdd(final Player player, final String permission) { - return playerAdd(player.getWorld().getName(), player, permission); - } - - /** - * Add transient permission to a player. - * This implementation can be used by any subclass which implements a "pure" superperms plugin, i.e. - * one that only needs the built-in Bukkit API to add transient permissions to a player. - * - * @param player to add to - * @param permission Permission node - * @return Success or Failure - */ - public boolean playerAddTransient(final OfflinePlayer player, final String permission) throws UnsupportedOperationException { - if (player.isOnline()) { - return playerAddTransient((Player) player, permission); - } - throw new UnsupportedOperationException(getName() + " does not support offline player transient permissions!"); - } - - /** - * Add transient permission to a player. - * This operation adds a permission onto the player object in bukkit via Bukkit's permission interface. - * - * @param player Player Object - * @param permission Permission node - * @return Success or Failure - */ - public boolean playerAddTransient(final Player player, final String permission) { - for (final PermissionAttachmentInfo paInfo : player.getEffectivePermissions()) { - if (paInfo.getAttachment() != null && paInfo.getAttachment().getPlugin().equals(plugin)) { - paInfo.getAttachment().setPermission(permission, true); - return true; - } - } - - final PermissionAttachment attach = player.addAttachment(plugin); - attach.setPermission(permission, true); - - return true; - } - - /** - * Adds a world specific transient permission to the player, may only work with some permission managers. - * Defaults to GLOBAL permissions for any permission system that does not support world-specific transient permissions! - * - * @param worldName to check on - * @param player to add to - * @param permission to test - * @return Success or Failure - */ - public boolean playerAddTransient(final String worldName, final OfflinePlayer player, final String permission) { - return playerAddTransient(player, permission); - } - - /** - * Adds a world specific transient permission to the player, may only work with some permission managers. - * Defaults to GLOBAL permissions for any permission system that does not support world-specific transient permissions! - * - * @param worldName to check on - * @param player to check - * @param permission to check for - * @return Success or Failure - */ - public boolean playerAddTransient(final String worldName, final Player player, final String permission) { - return playerAddTransient(player, permission); - } - - /** - * Removes a world specific transient permission from the player, may only work with some permission managers. - * Defaults to GLOBAL permissions for any permission system that does not support world-specific transient permissions! - * - * @param worldName to remove for - * @param player to remove for - * @param permission to remove - * @return Success or Failure - */ - public boolean playerRemoveTransient(final String worldName, final OfflinePlayer player, final String permission) { - return playerRemoveTransient(player, permission); - } - - /** - * Removes a world specific transient permission from the player, may only work with some permission managers. - * Defaults to GLOBAL permissions for any permission system that does not support world-specific transient permissions! - * - * @param worldName to check on - * @param player to check - * @param permission to check for - * @return Success or Failure - */ - public boolean playerRemoveTransient(final String worldName, final Player player, final String permission) { - return playerRemoveTransient((OfflinePlayer) player, permission); - } - - /** - * Checks if player has a permission node. - * Supports NULL value for World if the permission system registered supports global permissions. - * But May return odd values if the servers registered permission system does not have a global permission store. - * - * @param world String world name - * @param player to check - * @param permission Permission node - * @return Success or Failure - * @deprecated As of VaultAPI 1.4 use {@link #playerRemove(String, OfflinePlayer, String)} instead. - */ - @Deprecated - abstract public boolean playerRemove(String world, String player, String permission); - - /** - * Remove permission from a player. - * Supports NULL value for World if the permission system registered supports global permissions. - * But May return odd values if the servers registered permission system does not have a global permission store. - * - * @param world World name - * @param player OfflinePlayer - * @param permission Permission node - * @return Success or Failure - */ - public boolean playerRemove(final String world, final OfflinePlayer player, final String permission) { - if (world == null) { - return playerRemove((String) null, player.getName(), permission); - } - return playerRemove(world, player.getName(), permission); - } - - /** - * Remove permission from a player. - * Supports NULL value for World if the permission system registered supports global permissions. - * But May return odd values if the servers registered permission system does not have a global permission store. - * - * @param world World name - * @param player Player name - * @param permission Permission node - * @return Success or Failure - */ - @Deprecated - public boolean playerRemove(final World world, final String player, final String permission) { - if (world == null) { - return playerRemove((String) null, player, permission); - } - return playerRemove(world.getName(), player, permission); - } - - /** - * Remove permission from a player. - * Will attempt to remove permission from the player on the player's current world. This is NOT a global operation. - * - * @param player Player Object - * @param permission Permission node - * @return Success or Failure - */ - public boolean playerRemove(final Player player, final String permission) { - return playerRemove(player.getWorld().getName(), player, permission); - } - - - /** - * Remove transient permission from a player. - * This implementation can be used by any subclass which implements a "pure" superperms plugin, i.e. - * one that only needs the built-in Bukkit API to remove transient permissions from a player. Any subclass - * implementing a plugin which provides its own API for this needs to override this method. - * - * @param player OfflinePlayer - * @param permission Permission node - * @return Success or Failure - */ - public boolean playerRemoveTransient(final OfflinePlayer player, final String permission) { - if (player.isOnline()) { - return playerRemoveTransient((Player) player, permission); - } else { - return false; - } - } - - /** - * Remove transient permission from a player. - * - * @param player Player Object - * @param permission Permission node - * @return Success or Failure - */ - public boolean playerRemoveTransient(final Player player, final String permission) { - for (final PermissionAttachmentInfo paInfo : player.getEffectivePermissions()) { - if (paInfo.getAttachment() != null && paInfo.getAttachment().getPlugin().equals(plugin)) { - paInfo.getAttachment().unsetPermission(permission); - return true; - } - } - return false; - } - - /** - * Checks if group has a permission node. - * Supports NULL value for World if the permission system registered supports global permissions. - * But May return odd values if the servers registered permission system does not have a global permission store. - * - * @param world World name - * @param group Group name - * @param permission Permission node - * @return Success or Failure - */ - abstract public boolean groupHas(String world, String group, String permission); - - /** - * Checks if group has a permission node. - * Supports NULL value for World if the permission system registered supports global permissions. - * But May return odd values if the servers registered permission system does not have a global permission store. - * - * @param world World Object - * @param group Group name - * @param permission Permission node - * @return Success or Failure - */ - public boolean groupHas(final World world, final String group, final String permission) { - if (world == null) { - return groupHas((String) null, group, permission); - } - return groupHas(world.getName(), group, permission); - } - - /** - * Add permission to a group. - * Supports NULL value for World if the permission system registered supports global permissions. - * But May return odd values if the servers registered permission system does not have a global permission store. - * - * @param world World name - * @param group Group name - * @param permission Permission node - * @return Success or Failure - */ - abstract public boolean groupAdd(String world, String group, String permission); - - /** - * Add permission to a group. - * Supports NULL value for World if the permission system registered supports global permissions. - * But May return odd values if the servers registered permission system does not have a global permission store. - * - * @param world World Object - * @param group Group name - * @param permission Permission node - * @return Success or Failure - */ - public boolean groupAdd(final World world, final String group, final String permission) { - if (world == null) { - return groupAdd((String) null, group, permission); - } - return groupAdd(world.getName(), group, permission); - } - - /** - * Remove permission from a group. - * Supports NULL value for World if the permission system registered supports global permissions. - * But May return odd values if the servers registered permission system does not have a global permission store. - * - * @param world World name - * @param group Group name - * @param permission Permission node - * @return Success or Failure - */ - abstract public boolean groupRemove(String world, String group, String permission); - - /** - * Remove permission from a group. - * Supports NULL value for World if the permission system registered supports global permissions. - * But May return odd values if the servers registered permission system does not have a global permission store. - * - * @param world World Object - * @param group Group name - * @param permission Permission node - * @return Success or Failure - */ - public boolean groupRemove(final World world, final String group, final String permission) { - if (world == null) { - return groupRemove((String) null, group, permission); - } - return groupRemove(world.getName(), group, permission); - } - - /** - * Check if player is member of a group. - * Supports NULL value for World if the permission system registered supports global permissions. - * But May return odd values if the servers registered permission system does not have a global permission store. - * - * @param world World Object - * @param player to check - * @param group Group name - * @return Success or Failure - * @deprecated As of VaultAPI 1.4 use {@link #playerInGroup(String, OfflinePlayer, String)} instead. - */ - @Deprecated - abstract public boolean playerInGroup(String world, String player, String group); - - /** - * Check if player is member of a group. - * Supports NULL value for World if the permission system registered supports global permissions. - * But May return odd values if the servers registered permission system does not have a global permission store. - * - * @param world World Object - * @param player to check - * @param group Group name - * @return Success or Failure - * @deprecated As of VaultAPI 1.4 use {@link #playerInGroup(String, OfflinePlayer, String)} instead. - */ - @Deprecated - public boolean playerInGroup(final World world, final String player, final String group) { - if (world == null) { - return playerInGroup((String) null, player, group); - } - return playerInGroup(world.getName(), player, group); - } - - /** - * Check if player is member of a group. - * Supports NULL value for World if the permission system registered supports global permissions. - * But May return odd values if the servers registered permission system does not have a global permission store. - * - * @param world World Object - * @param player to check - * @param group Group name - * @return Success or Failure - */ - public boolean playerInGroup(final String world, final OfflinePlayer player, final String group) { - if (world == null) { - return playerInGroup((String) null, player.getName(), group); - } - return playerInGroup(world, player.getName(), group); - } - - /** - * Check if player is member of a group. - * This method will ONLY check groups for which the player is in that are defined for the current world. - * This may result in odd return behaviour depending on what permission system has been registered. - * - * @param player Player Object - * @param group Group name - * @return Success or Failure - */ - public boolean playerInGroup(final Player player, final String group) { - return playerInGroup(player.getWorld().getName(), player, group); - } - - /** - * Add player to a group. - * Supports NULL value for World if the permission system registered supports global permissions. - * But May return odd values if the servers registered permission system does not have a global permission store. - * - * @param world String world name - * @param player to add - * @param group Group name - * @return Success or Failure - * @deprecated As of VaultAPI 1.4 use {@link #playerAddGroup(String, OfflinePlayer, String)} instead. - */ - @Deprecated - abstract public boolean playerAddGroup(String world, String player, String group); - - /** - * Add player to a group. - * Supports NULL value for World if the permission system registered supports global permissions. - * But May return odd values if the servers registered permission system does not have a global permission store. - * - * @param world String world name - * @param player to add - * @param group Group name - * @return Success or Failure - * @deprecated As of VaultAPI 1.4 use {@link #playerAddGroup(String, OfflinePlayer, String)} instead. - */ - @Deprecated - public boolean playerAddGroup(final World world, final String player, final String group) { - if (world == null) { - return playerAddGroup((String) null, player, group); - } - return playerAddGroup(world.getName(), player, group); - } - - /** - * Add player to a group. - * Supports NULL value for World if the permission system registered supports global permissions. - * But May return odd values if the servers registered permission system does not have a global permission store. - * - * @param world String world name - * @param player to add - * @param group Group name - * @return Success or Failure - */ - public boolean playerAddGroup(final String world, final OfflinePlayer player, final String group) { - if (world == null) { - return playerAddGroup((String) null, player.getName(), group); - } - return playerAddGroup(world, player.getName(), group); - } - - /** - * Add player to a group. - * This will add a player to the group on the current World. This may return odd results if the permission system - * being used on the server does not support world-specific groups, or if the group being added to is a global group. - * - * @param player Player Object - * @param group Group name - * @return Success or Failure - */ - public boolean playerAddGroup(final Player player, final String group) { - return playerAddGroup(player.getWorld().getName(), player, group); - } - - /** - * Remove player from a group. - * Supports NULL value for World if the permission system registered supports global permissions. - * But May return odd values if the servers registered permission system does not have a global permission store. - * - * @param world World Object - * @param player to remove - * @param group Group name - * @return Success or Failure - * @deprecated As of VaultAPI 1.4 use {@link #playerRemoveGroup(String, OfflinePlayer, String)} instead. - */ - @Deprecated - abstract public boolean playerRemoveGroup(String world, String player, String group); - - /** - * Remove player from a group. - * Supports NULL value for World if the permission system registered supports global permissions. - * But May return odd values if the servers registered permission system does not have a global permission store. - * - * @param world World Object - * @param player to remove - * @param group Group name - * @return Success or Failure - * @deprecated As of VaultAPI 1.4 use {@link #playerRemoveGroup(String, OfflinePlayer, String)} instead. - */ - @Deprecated - public boolean playerRemoveGroup(final World world, final String player, final String group) { - if (world == null) { - return playerRemoveGroup((String) null, player, group); - } - return playerRemoveGroup(world.getName(), player, group); - } - - /** - * Remove player from a group. - * Supports NULL value for World if the permission system registered supports global permissions. - * But May return odd values if the servers registered permission system does not have a global permission store. - * - * @param world World Object - * @param player to remove - * @param group Group name - * @return Success or Failure - */ - public boolean playerRemoveGroup(final String world, final OfflinePlayer player, final String group) { - if (world == null) { - return playerRemoveGroup((String) null, player.getName(), group); - } - return playerRemoveGroup(world, player.getName(), group); - } - - /** - * Remove player from a group. - * This will add a player to the group on the current World. This may return odd results if the permission system - * being used on the server does not support world-specific groups, or if the group being added to is a global group. - * - * @param player Player Object - * @param group Group name - * @return Success or Failure - */ - public boolean playerRemoveGroup(final Player player, final String group) { - return playerRemoveGroup(player.getWorld().getName(), player, group); - } - - /** - * Gets the list of groups that this player has - * Supports NULL value for World if the permission system registered supports global permissions. - * But May return odd values if the servers registered permission system does not have a global permission store. - * - * @param world String world name - * @param player OfflinePlayer - * @return Array of groups - * @deprecated As of VaultAPI 1.4 use {@link #getPlayerGroups(String, OfflinePlayer)} instead. - */ - @Deprecated - abstract public String[] getPlayerGroups(String world, String player); - - /** - * Gets the list of groups that this player has - * Supports NULL value for World if the permission system registered supports global permissions. - * But May return odd values if the servers registered permission system does not have a global permission store. - * - * @param world String world name - * @param player OfflinePlayer - * @return Array of groups - * @deprecated As of VaultAPI 1.4 use {@link #getPlayerGroups(String, OfflinePlayer)} instead. - */ - @Deprecated - public String[] getPlayerGroups(final World world, final String player) { - if (world == null) { - return getPlayerGroups((String) null, player); - } - return getPlayerGroups(world.getName(), player); - } - - /** - * Gets the list of groups that this player has - * Supports NULL value for World if the permission system registered supports global permissions. - * But May return odd values if the servers registered permission system does not have a global permission store. - * - * @param world String world name - * @param player OfflinePlayer - * @return Array of groups - */ - public String[] getPlayerGroups(final String world, final OfflinePlayer player) { - return getPlayerGroups(world, player.getName()); - } - - /** - * Returns a list of world-specific groups that this player is currently in. May return unexpected results if - * you are looking for global groups, or if the registered permission system does not support world-specific groups. - * See {@link #getPlayerGroups(String, OfflinePlayer)} for better control of World-specific or global groups. - * - * @param player Player Object - * @return Array of groups - */ - public String[] getPlayerGroups(final Player player) { - return getPlayerGroups(player.getWorld().getName(), player); - } - - /** - * Gets players primary group - * Supports NULL value for World if the permission system registered supports global permissions. - * But May return odd values if the servers registered permission system does not have a global permission store. - * - * @param world String world name - * @param player to get from - * @return Players primary group - * @deprecated As of VaultAPI 1.4 use {@link #getPrimaryGroup(String, OfflinePlayer)} instead. - */ - @Deprecated - abstract public String getPrimaryGroup(String world, String player); - - /** - * Gets players primary group - * Supports NULL value for World if the permission system registered supports global permissions. - * But May return odd values if the servers registered permission system does not have a global permission store. - * - * @param world String world name - * @param player to get from - * @return Players primary group - * @deprecated As of VaultAPI 1.4 use {@link #getPrimaryGroup(String, OfflinePlayer)} instead. - */ - @Deprecated - public String getPrimaryGroup(final World world, final String player) { - if (world == null) { - return getPrimaryGroup((String) null, player); - } - return getPrimaryGroup(world.getName(), player); - } - - /** - * Gets players primary group - * Supports NULL value for World if the permission system registered supports global permissions. - * But May return odd values if the servers registered permission system does not have a global permission store. - * - * @param world String world name - * @param player to get from - * @return Players primary group - */ - public String getPrimaryGroup(final String world, final OfflinePlayer player) { - return getPrimaryGroup(world, player.getName()); - } - - /** - * Get players primary group. - * Defaults to the players current world, so may return only world-specific groups. - * In most cases {@link #getPrimaryGroup(String, OfflinePlayer)} is preferable. - * - * @param player Player Object - * @return Players primary group - */ - public String getPrimaryGroup(final Player player) { - return getPrimaryGroup(player.getWorld().getName(), player); - } - - /** - * Returns a list of all known groups - * @return an Array of String of all groups - */ - abstract public String[] getGroups(); - - /** - * Returns true if the given implementation supports groups. - * @return true if the implementation supports groups - */ - abstract public boolean hasGroupSupport(); -} \ No newline at end of file diff --git a/src/main/java/net/milkbowl/vault2/permission/PermissionUnlocked.java b/src/main/java/net/milkbowl/vault2/permission/PermissionUnlocked.java new file mode 100644 index 0000000..75c3ae4 --- /dev/null +++ b/src/main/java/net/milkbowl/vault2/permission/PermissionUnlocked.java @@ -0,0 +1,368 @@ +package net.milkbowl.vault2.permission; +/* + 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 . + */ + +import net.milkbowl.vault2.helper.Context; +import net.milkbowl.vault2.helper.Subject; +import net.milkbowl.vault2.helper.TriState; +import org.jetbrains.annotations.NotNull; + +import java.util.concurrent.CompletableFuture; + +/** + * PermissionsUnlocked + * + * @author creatorfromhell + * @since 2.18 + */ +public interface PermissionUnlocked { + + /** + * Checks whether this permission provider is enabled. + * + * @return true if the permission provider is enabled; false otherwise. + * @since 2.18 + */ + boolean isEnabled(); + + /** + * Retrieves the name of this permission provider. + * + * @return the name of the permission provider as a non-null string. + * @since 2.18 + */ + @NotNull + String getName(); + + /** + * Checks whether the permission provider supports group-based permissions. + * + * @return true if group-based permissions are supported; false otherwise. + * @since 2.18 + */ + boolean hasGroupSupport(); + + /** + * Checks whether the permission provider supports SuperPerms. + * + * @return true if SuperPerms are supported; false otherwise. + * @since 2.18 + */ + boolean hasSuperPermsSupport(); + + /** + * Retrieves the permission state for a given context, subject, and permission identifier. + * + * @param context the context in which the permission is being checked cannot be null + * @param subject the subject for whom the permission is being checked cannot be null + * @param permission the identifier of the permission to check cannot be null + * @return a {@link TriState} value indicating the permission state, which can be TRUE, FALSE, or UNDEFINED + * @since 2.18 + */ + @NotNull + TriState has(@NotNull Context context, @NotNull Subject subject, @NotNull String permission); + + /** + * Asynchronously retrieves the permission state for a given context, subject, and permission identifier. + * + * @param context the context in which the permission is being checked; cannot be null + * @param subject the subject for whom the permission is being checked; cannot be null + * @param permission the identifier of the permission to check; cannot be null + * @return a {@link CompletableFuture} that completes with a {@link TriState} value indicating the permission state, + * which can be TRUE, FALSE, or UNDEFINED + * @since 2.18 + */ + @NotNull + CompletableFuture hasAsync(@NotNull final Context context, @NotNull final Subject subject, + @NotNull final String permission); + + /** + * Sets the specified permission for a subject within a given context to a specified state. + * + * @param context the context in which the permission is being set; cannot be null + * @param subject the subject for whom the permission is being set; cannot be null + * @param permission the identifier of the permission to modify; cannot be null + * @param value the {@link TriState} value indicating the desired state of the permission; cannot be null + * @return true if the permission was successfully set, false otherwise + * @since 2.18 + */ + boolean setPermission(@NotNull Context context, @NotNull Subject subject, @NotNull String permission, + @NotNull TriState value); + + /** + * Asynchronously sets the specified permission to a given tri-state value for a subject within a context. + * + * @param context the context within which the permission should be set, not null + * @param subject the subject for whom the permission is being set, not null + * @param permission the specific permission to set, not null + * @param value the tri-state value to set for the permission, not null + * @return a CompletableFuture that completes with `true` if the permission was successfully set, + * or `false` if the operation failed + * @since 2.18 + */ + @NotNull + CompletableFuture setPermissionAsync(@NotNull Context context, @NotNull Subject subject, + @NotNull String permission, @NotNull TriState value); + + /** + * Sets a transient permission for a specific subject within a given context to a specified value. + * Transient permissions are temporary and do not persist beyond the current runtime. + * + * @param context the context in which the permission is being set; cannot be null + * @param subject the subject for whom the transient permission is being set; cannot be null + * @param permission the identifier of the permission to modify; cannot be null + * @param value the {@link TriState} value indicating the desired state of the permission; cannot be null + * @return true if the transient permission was successfully set, false otherwise + * @since 2.18 + */ + boolean setTransientPermission(@NotNull Context context, @NotNull Subject subject, @NotNull String permission, + @NotNull TriState value); + + /** + * Asynchronously sets a transient permission for the specified subject in the given context. + * A transient permission is not persisted and will only last for the duration of the program's runtime. + * + * @param context the context in which the permission is to be set, must not be null + * @param subject the subject to which the permission is to be assigned, must not be null + * @param permission the permission string to be set, must not be null + * @param value the state of the permission (true, false, or undefined), must not be null + * + * @return a CompletableFuture that will complete with a boolean indicating whether the permission change was successful + * @since 2.18 + */ + @NotNull + CompletableFuture setTransientPermissionAsync(@NotNull Context context, @NotNull Subject subject, + @NotNull String permission, @NotNull TriState value); + + /** + * Retrieves the array of group names associated with this permission provider. + * + * @return an array of group names as non-null strings. The array may be empty if no groups are defined. + * @since 2.18 + */ + @NotNull + String[] groups(); + + /** + * Retrieves the primary group associated with the specified subject in the given context. + * + * @param context the context in which the primary group is being queried; cannot be null + * @param subject the subject whose primary group is being retrieved; cannot be null + * @return the name of the primary group associated with the subject within the specified context, + * or null if no primary group is defined + * @since 2.18 + */ + String primaryGroup(@NotNull Context context, @NotNull Subject subject); + + /** + * Asynchronously retrieves the primary group associated with the specified subject in the given context. + * + * @param context the context in which the primary group is being queried; cannot be null + * @param subject the subject whose primary group is being retrieved; cannot be null + * @return a {@link CompletableFuture} that completes with the name of the primary group associated with the subject + * within the specified context, or completes with null if no primary group is defined + * @since 2.18 + */ + @NotNull + CompletableFuture primaryGroupAsync(@NotNull Context context, @NotNull Subject subject); + + /** + * Retrieves the groups associated with the provided subject in the specified context. + * + * @param context the context in which the subject's group memberships are being retrieved; cannot be null + * @param subject the subject whose group memberships are being retrieved; cannot be null + * @return an array of group names associated with the subject within the specified context; may be + * empty if no groups are associated + * @since 2.18 + */ + @NotNull + String[] getGroups(@NotNull Context context, @NotNull Subject subject); + + /** + * Asynchronously retrieves the groups associated with the specified subject within the given context. + * + * @param context the context in which the subject's group memberships are being retrieved; cannot be null + * @param subject the subject whose group memberships are being retrieved; cannot be null + * @return a {@link CompletableFuture} that completes with an array of group names associated with the subject + * within the specified context; the array may be empty if no groups are associated + * @since 2.18 + */ + @NotNull + CompletableFuture getGroupsAsync(@NotNull Context context, @NotNull Subject subject); + + /** + * Determines whether the specified subject is in a group within the given context. + * + * @param context the context in which the group membership is being checked; cannot be null + * @param subject the subject for whom the group membership is being checked; cannot be null + * @return true if the subject is a member of a group within the specified context; false otherwise + * @since 2.18 + */ + boolean inGroup(@NotNull Context context, @NotNull Subject subject); + + /** + * Asynchronously checks if the specified subject is part of a group in the given context. + * + * @param context the context in which the group check is performed; must not be null. + * @param subject the subject to check for group membership; must not be null. + * @return a CompletableFuture that will be completed with true if the subject is in the group, false otherwise. + * @since 2.18 + */ + @NotNull + CompletableFuture inGroupAsync(@NotNull Context context, @NotNull Subject subject); + + /** + * Assigns the specified subject to a given group within the provided context. + * + * @param context the context in which the group assignment is being performed; cannot be null + * @param subject the subject to be assigned to the group; cannot be null + * @param group the name of the group the subject should be assigned to; cannot be null + * @return true if the group was successfully set for the subject, false otherwise + * @since 2.18 + */ + boolean addGroup(@NotNull Context context, @NotNull Subject subject, @NotNull String group); + + /** + * Adds a group to the specified subject within the provided context. + * + * @param context the operational context in which the group addition should occur, must not be null + * @param subject the subject to whom the group will be added, must not be null + * @param group the name of the group to be added, must not be null + * @return a CompletableFuture that resolves to true if the group was successfully added, or false otherwise + * @since 2.18 + */ + @NotNull + CompletableFuture addGroupAsync(@NotNull Context context, @NotNull Subject subject, + @NotNull String group); + + /** + * Removes the specified subject from the given group within the provided context. + * + * @param context the context in which the operation is being performed; cannot be null + * @param subject the subject to be removed from the group; cannot be null + * @param group the name of the group the subject should be removed from; cannot be null + * @return true if the subject was successfully removed from the group, false otherwise + * @since 2.18 + */ + boolean removeGroup(@NotNull Context context, @NotNull Subject subject, @NotNull String group); + + /** + * Removes the specified group from the given subject within the provided context. + * + * @param context the context in which the group is to be removed, must not be null + * @param subject the subject from which the group is to be removed, must not be null + * @param group the name of the group to remove, must not be null + * @return a CompletableFuture that resolves to a Boolean indicating whether the group was successfully removed + * @since 2.18 + */ + @NotNull + CompletableFuture removeGroupAsync(@NotNull Context context, @NotNull Subject subject, + @NotNull String group); + + /** + * Checks whether the specified group has the given permission for a subject within the context. + * + * @param context the context in which the group permission is being checked; cannot be null + * @param subject the subject for whom the group permission is being checked; cannot be null + * @param group the name of the group whose permission is being checked; cannot be null + * @param permission the specific permission identifier to be checked; cannot be null + * @return a {@link TriState} value indicating the state of the permission for the group, + * which can be TRUE, FALSE, or UNDEFINED + * @since 2.18 + */ + @NotNull + TriState groupHas(@NotNull Context context, @NotNull Subject subject, @NotNull String group, + @NotNull String permission); + + /** + * Checks if a specific group has a given permission for a subject within a provided context. + * + * @param context the context in which the check is performed; must not be null + * @param subject the subject for which the group's permission is being checked; must not be null + * @param group the name of the group being checked; must not be null + * @param permission the permission being checked for the group; must not be null + * @return a CompletableFuture that resolves to a TriState, indicating whether the group has the + * specified permission (TRUE, FALSE, or UNDEFINED); never null + * @since 2.18 + */ + @NotNull + CompletableFuture groupHasAsync(@NotNull Context context, @NotNull Subject subject, + @NotNull String group, @NotNull String permission); + + /** + * Sets the specified permission for a subject in a given group within a specified context to a desired state. + * + * @param context the context in which the group permission is being set; cannot be null + * @param subject the subject for whom the group permission is being set; cannot be null + * @param group the name of the group for which the permission is assigned; cannot be null + * @param permission the identifier of the permission to modify; cannot be null + * @param value the {@link TriState} value indicating the desired state of the permission; cannot be null + * @return true if the permission was successfully set for the group, false otherwise + * @since 2.18 + */ + boolean groupSetPermission(@NotNull Context context, @NotNull Subject subject, @NotNull String group, + @NotNull String permission, @NotNull TriState value); + + /** + * Sets a specific permission for a group associated with a given subject in the provided context. + * The permission's state can be set to true, false, or undefined using the TriState value. + * + * @param context the context in which the group and subject operate, must not be null + * @param subject the subject for which the permission is being set, must not be null + * @param group the name of the group for which the permission is being set, must not be null + * @param permission the permission string to be set for the group, must not be null + * @param value the TriState value representing the desired state of the permission (true, false, or undefined), must not be null + * @return a CompletableFuture that completes with a Boolean indicating whether the operation was successful + * @since 2.18 + */ + @NotNull + CompletableFuture groupSetPermissionAsync(@NotNull Context context, @NotNull Subject subject, + @NotNull String group, @NotNull String permission, + @NotNull TriState value); + + /** + * Sets a transient permission for a specific group within a given context and subject. + * Transient permissions are temporary and do not persist beyond the current runtime. + * + * @param context the context in which the permission is being set; cannot be null + * @param subject the subject for whom the group permission is being set; cannot be null + * @param group the name of the group for which the transient permission is assigned; cannot be null + * @param permission the identifier of the permission to modify; cannot be null + * @param value the {@link TriState} value indicating the desired state of the permission; cannot be null + * @return true if the transient permission was successfully set for the group, false otherwise + * @since 2.18 + */ + boolean groupSetTransientPermission(@NotNull Context context, @NotNull Subject subject, @NotNull String group, + @NotNull String permission, @NotNull TriState value); + + /** + * Sets a transient permission for a specific group within the given subject and context. + * The permission will only exist for the duration of the running session and is not persisted. + * + * @param context the context in which the permission should be applied, must not be null + * @param subject the subject to which the permission is being applied, must not be null + * @param group the name of the group the permission applies to, must not be null + * @param permission the specific permission to be set, must not be null + * @param value the value of the permission, represented by TriState, must not be null + * @return a CompletableFuture that completes with a Boolean indicating if the operation was successful + * @since 2.18 + */ + @NotNull + CompletableFuture groupSetTransientPermissionAsync(@NotNull Context context, @NotNull Subject subject, + @NotNull String group, @NotNull String permission, + @NotNull TriState value); +} \ No newline at end of file From c62043ad3175e4e21acfa97a46701fcd2a0bcf3e Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Sun, 23 Nov 2025 22:07:32 -0500 Subject: [PATCH 91/95] Remove `Chat` class from VaultAPI. - Fully removed the `Chat` API implementation, including all related methods and deprecated functionality. --- .changelog/2.18.md | 3 +- .../java/net/milkbowl/vault2/chat/Chat.java | 995 ------------------ .../milkbowl/vault2/chat/ChatUnlocked.java | 146 +++ .../net/milkbowl/vault2/helper/Context.java | 7 +- .../net/milkbowl/vault2/helper/Subject.java | 5 +- 5 files changed, 155 insertions(+), 1001 deletions(-) delete mode 100644 src/main/java/net/milkbowl/vault2/chat/Chat.java create mode 100644 src/main/java/net/milkbowl/vault2/chat/ChatUnlocked.java diff --git a/.changelog/2.18.md b/.changelog/2.18.md index 5a0935a..63c4598 100644 --- a/.changelog/2.18.md +++ b/.changelog/2.18.md @@ -1,4 +1,5 @@ # 2.18 ## API Changes -Revamped Permission API to include a modern permission API for VaultUnlocked specifically. \ No newline at end of file +- Revamped Permission API to include a modern permission API for VaultUnlocked specifically. +- Revamped Chat API to include a modern chat API for VaultUnlocked specifically. \ No newline at end of file diff --git a/src/main/java/net/milkbowl/vault2/chat/Chat.java b/src/main/java/net/milkbowl/vault2/chat/Chat.java deleted file mode 100644 index 7c48870..0000000 --- a/src/main/java/net/milkbowl/vault2/chat/Chat.java +++ /dev/null @@ -1,995 +0,0 @@ -/* 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 . -*/ -package net.milkbowl.vault2.chat; - -import net.milkbowl.vault2.permission.Permission; - -import org.bukkit.OfflinePlayer; -import org.bukkit.World; -import org.bukkit.entity.Player; - -/** - * The main Chat API - allows for Prefix/Suffix nodes along with generic Info nodes if the linked Chat system supports them - * - */ -public abstract class Chat { - - private Permission perms; - - public Chat(Permission perms) { - this.perms = perms; - } - /** - * Gets name of permission method - * @return Name of Permission Method - */ - abstract public String getName(); - - /** - * Checks if permission method is enabled. - * @return Success or Failure - */ - abstract public boolean isEnabled(); - - /** - * @deprecated As of VaultAPI 1.4 use {{@link #getPlayerPrefix(String, OfflinePlayer)} instead. - * - * Get players prefix - * @param world World name - * @param player Player name - * @return Prefix - */ - @Deprecated - abstract public String getPlayerPrefix(String world, String player); - - /** - * Get a players prefix in the given world - * Use NULL for world if requesting a global prefix - * - * @param world World name - * @param player OfflinePlayer - * @return Prefix - */ - public String getPlayerPrefix(String world, OfflinePlayer player) { - return getPlayerPrefix(world, player.getName()); - } - - /** - * @deprecated As of VaultAPI 1.4 use {{@link #getPlayerPrefix(String, OfflinePlayer)} instead. - * - * Get players prefix - * @param world World Object - * @param player Player name - * @return Prefix - */ - @Deprecated - public String getPlayerPrefix(World world, String player) { - return getPlayerPrefix(world.getName(), player); - } - - /** - * Get players prefix from the world they are currently in. - * May or may not return the global prefix depending on implementation. - * - * @param player Player Object - * @return Prefix - */ - public String getPlayerPrefix(Player player) { - return getPlayerPrefix(player.getWorld().getName(), player); - } - - /** - * @deprecated As of VaultAPI 1.4 use {{@link #setPlayerPrefix(String, OfflinePlayer, String)} instead. - * - * Set players prefix - * @param world World name - * @param player Player name - * @param prefix Prefix - */ - @Deprecated - abstract public void setPlayerPrefix(String world, String player, String prefix); - - /** - * Sets players prefix in the given world. - * Use NULL for world for setting in the Global scope. - * - * @param world World name - * @param player OfflinePlayer - * @param prefix Prefix - */ - public void setPlayerPrefix(String world, OfflinePlayer player, String prefix) { - setPlayerPrefix(world, player.getName(), prefix); - } - - /** - * @deprecated As of VaultAPI 1.4 use {{@link #setPlayerPrefix(String, OfflinePlayer, String)} instead. - * - * Set players prefix in the given world. - * - * @param world World Object - * @param player Player name - * @param prefix Prefix - */ - @Deprecated - public void setPlayerPrefix(World world, String player, String prefix) { - setPlayerPrefix(world.getName(), player, prefix); - } - - /** - * Set players prefix in the world they are currently in. - * - * @param player Player Object - * @param prefix Prefix - */ - public void setPlayerPrefix(Player player, String prefix) { - setPlayerPrefix(player.getWorld().getName(), player, prefix); - } - - /** - * @deprecated As of VaultAPI 1.4 use {{@link #getPlayerSuffix(String, OfflinePlayer)} instead. - * - * Get players suffix - * @param world World name - * @param player Player name - * @return Suffix - */ - @Deprecated - abstract public String getPlayerSuffix(String world, String player); - - /** - * Get players suffix in the specified world. - * - * @param world World name - * @param player OfflinePlayer name - * @return Suffix - */ - public String getPlayerSuffix(String world, OfflinePlayer player) { - return getPlayerSuffix(world, player.getName()); - } - - /** - * @deprecated As of VaultAPI 1.4 use {{@link #getPlayerSuffix(String, OfflinePlayer)} instead. - * - * Get players suffix - * @param world World Object - * @param player Player name - * @return Suffix - */ - @Deprecated - public String getPlayerSuffix(World world, String player) { - return getPlayerSuffix(world.getName(), player); - } - - /** - * Get players suffix in the world they are currently in. - * - * @param player Player Object - * @return Suffix - */ - public String getPlayerSuffix(Player player) { - return getPlayerSuffix(player.getWorld().getName(), player); - } - - /** - * @deprecated As of VaultAPI 1.4 use {{@link #setPlayerSuffix(String, OfflinePlayer, String)} instead. - * - * Set players suffix - * @param world World name - * @param player Player name - * @param suffix Suffix - */ - @Deprecated - abstract public void setPlayerSuffix(String world, String player, String suffix); - - /** - * Set players suffix for the world specified - * - * @param world World name - * @param player OfflinePlayer - * @param suffix Suffix - */ - public void setPlayerSuffix(String world, OfflinePlayer player, String suffix) { - setPlayerSuffix(world, player.getName(), suffix); - } - - /** - * @deprecated As of VaultAPI 1.4 use {{@link #setPlayerSuffix(String, OfflinePlayer, String)} instead. - * - * Set players suffix - * @param world World Object - * @param player Player name - * @param suffix Suffix - */ - @Deprecated - public void setPlayerSuffix(World world, String player, String suffix) { - setPlayerSuffix(world.getName(), player, suffix); - } - - /** - * Set players suffix in the world they currently occupy. - * - * @param player Player Object - * @param suffix Suffix - */ - public void setPlayerSuffix(Player player, String suffix) { - setPlayerSuffix(player.getWorld().getName(), player, suffix); - } - - /** - * Get group prefix - * @param world World name - * @param group Group name - * @return Prefix - */ - abstract public String getGroupPrefix(String world, String group); - - /** - * Get group prefix - * @param world World Object - * @param group Group name - * @return Prefix - */ - public String getGroupPrefix(World world, String group) { - return getGroupPrefix(world.getName(), group); - } - - /** - * Set group prefix - * @param world World name - * @param group Group name - * @param prefix Prefix - */ - abstract public void setGroupPrefix(String world, String group, String prefix); - - /** - * Set group prefix - * @param world World Object - * @param group Group name - * @param prefix Prefix - */ - public void setGroupPrefix(World world, String group, String prefix) { - setGroupPrefix(world.getName(), group, prefix); - } - - /** - * Get group suffix - * @param world World name - * @param group Group name - * @return Suffix - */ - abstract public String getGroupSuffix(String world, String group); - - /** - * Get group suffix - * @param world World Object - * @param group Group name - * @return Suffix - */ - public String getGroupSuffix(World world, String group) { - return getGroupSuffix(world.getName(), group); - } - - /** - * Set group suffix - * @param world World name - * @param group Group name - * @param suffix Suffix - */ - abstract public void setGroupSuffix(String world, String group, String suffix); - - /** - * Set group suffix - * @param world World Object - * @param group Group name - * @param suffix Suffix - */ - public void setGroupSuffix(World world, String group, String suffix) { - setGroupSuffix(world.getName(), group, suffix); - } - - /** - * Get a players informational node (Integer) value - * @param world World name - * @param player OfflinePlayer - * @param node Permission node - * @param defaultValue Default value - * @return Value - */ - public int getPlayerInfoInteger(String world, OfflinePlayer player, String node, int defaultValue) { - return getPlayerInfoInteger(world, player.getName(), node, defaultValue); - } - - /** - * @deprecated As of VaultAPI 1.4 use {{@link #getPlayerInfoInteger(String, OfflinePlayer, String, int)} instead. - * Get a players informational node (Integer) value - * @param world World name - * @param player Player name - * @param node Permission node - * @param defaultValue Default value - * @return Value - */ - @Deprecated - abstract public int getPlayerInfoInteger(String world, String player, String node, int defaultValue); - - /** - * @deprecated As of VaultAPI 1.4 use {{@link #getPlayerInfoInteger(String, OfflinePlayer, String, int)} instead. - * - * Get a players informational node (Integer) value - * @param world World Object - * @param player Player name - * @param node Permission node - * @param defaultValue Default value - * @return Value - */ - @Deprecated - public int getPlayerInfoInteger(World world, String player, String node, int defaultValue) { - return getPlayerInfoInteger(world.getName(), player, node, defaultValue); - } - - /** - * Get a players informational node (Integer) value - * @param player Player Object - * @param node Permission node - * @param defaultValue Default value - * @return Value - */ - public int getPlayerInfoInteger(Player player, String node, int defaultValue) { - return getPlayerInfoInteger(player.getWorld().getName(), player, node, defaultValue); - } - - /** - * Set a players informational node (Integer) value - * @param world World name - * @param player OfflinePlayer - * @param node Permission node - * @param value Value to set - */ - public void setPlayerInfoInteger(String world, OfflinePlayer player, String node, int value) { - setPlayerInfoInteger(world, player.getName(), node, value); - } - - /** - * @deprecated As of VaultAPI 1.4 use {{@link #setPlayerInfoInteger(String, OfflinePlayer, String, int)} instead. - * - * Set a players informational node (Integer) value - * @param world World name - * @param player Player name - * @param node Permission node - * @param value Value to set - */ - @Deprecated - abstract public void setPlayerInfoInteger(String world, String player, String node, int value); - - /** - * @deprecated As of VaultAPI 1.4 use {{@link #setPlayerInfoInteger(String, OfflinePlayer, String, int)} instead. - * - * Set a players informational node (Integer) value - * @param world World Object - * @param player Player name - * @param node Permission node - * @param value Value to set - */ - @Deprecated - public void setPlayerInfoInteger(World world, String player, String node, int value) { - setPlayerInfoInteger(world.getName(), player, node, value); - } - - /** - * Set a players informational node (Integer) value - * @param player Player Object - * @param node Permission node - * @param value Value to set - */ - public void setPlayerInfoInteger(Player player, String node, int value) { - setPlayerInfoInteger(player.getWorld().getName(), player, node, value); - } - - /** - * Get a groups informational node (Integer) value - * @param world World name - * @param group Group name - * @param node Permission node - * @param defaultValue Default value - * @return Value - */ - abstract public int getGroupInfoInteger(String world, String group, String node, int defaultValue); - - /** - * Get a groups informational node (Integer) value - * @param world World Object - * @param group Group name - * @param node Permission node - * @param defaultValue Default value - * @return Value - */ - public int getGroupInfoInteger(World world, String group, String node, int defaultValue) { - return getGroupInfoInteger(world.getName(), group, node, defaultValue); - } - - /** - * Set a groups informational node (Integer) value - * @param world World name - * @param group Group name - * @param node Permission node - * @param value Value to set - */ - abstract public void setGroupInfoInteger(String world, String group, String node, int value); - - /** - * Set a groups informational node (Integer) value - * @param world World Object - * @param group Group name - * @param node Permission node - * @param value Value to set - */ - public void setGroupInfoInteger(World world, String group, String node, int value) { - setGroupInfoInteger(world.getName(), group, node, value); - } - - /** - * Get a players informational node (Double) value - * @param world World name - * @param player OfflinePlayer - * @param node Permission node - * @param defaultValue Default value - * @return Value - */ - public double getPlayerInfoDouble(String world, OfflinePlayer player, String node, double defaultValue) { - return getPlayerInfoDouble(world, player.getName(), node, defaultValue); - } - - /** - * @deprecated As of VaultAPI 1.4 use {{@link #getPlayerInfoDouble(String, OfflinePlayer, String, double)} instead. - * - * Get a players informational node (Double) value - * @param world World name - * @param player Player name - * @param node Permission node - * @param defaultValue Default value - * @return Value - */ - @Deprecated - abstract public double getPlayerInfoDouble(String world, String player, String node, double defaultValue); - - /** - * @deprecated As of VaultAPI 1.4 use {{@link #getPlayerInfoDouble(String, OfflinePlayer, String, double)} instead - * - * Get a players informational node (Double) value - * @param world World Object - * @param player Player name - * @param node Permission node - * @param defaultValue Default value - * @return Value - */ - @Deprecated - public double getPlayerInfoDouble(World world, String player, String node, double defaultValue) { - return getPlayerInfoDouble(world.getName(), player, node, defaultValue); - } - - /** - * Get a players informational node (Double) value - * @param player Player Object - * @param node Permission node - * @param defaultValue Default value - * @return Value - */ - public double getPlayerInfoDouble(Player player, String node, double defaultValue) { - return getPlayerInfoDouble(player.getWorld().getName(), player, node, defaultValue); - } - - /** - * Set a players informational node (Double) value - * @param world World name - * @param player OfflinePlayer - * @param node Permission node - * @param value Value to set - */ - public void setPlayerInfoDouble(String world, OfflinePlayer player, String node, double value) { - setPlayerInfoDouble(world, player.getName(), node, value); - } - - /** - * @deprecated As of VaultAPI 1.4 use {{@link #setPlayerInfoDouble(String, OfflinePlayer, String, double)} instead. - * Set a players informational node (Double) value - * @param world World name - * @param player Player name - * @param node Permission node - * @param value Value to set - */ - @Deprecated - abstract public void setPlayerInfoDouble(String world, String player, String node, double value); - - /** - * @deprecated As of VaultAPI 1.4 use {{@link #setPlayerInfoDouble(String, OfflinePlayer, String, double)} instead. - * Set a players informational node (Double) value - * @param world World Object - * @param player Player name - * @param node Permission node - * @param value Value to set - */ - @Deprecated - public void setPlayerInfoDouble(World world, String player, String node, double value) { - setPlayerInfoDouble(world.getName(), player, node, value); - } - - /** - * Set a players informational node (Double) value - * @param player Player Object - * @param node Permission node - * @param value Value to set - */ - public void setPlayerInfoDouble(Player player, String node, double value) { - setPlayerInfoDouble(player.getWorld().getName(), player, node, value); - } - - /** - * Get a groups informational node (Double) value - * @param world World name - * @param group Group name - * @param node Permission node - * @param defaultValue Default value - * @return Value - */ - abstract public double getGroupInfoDouble(String world, String group, String node, double defaultValue); - - /** - * Get a groups informational node (Double) value - * @param world World Object - * @param group Group name - * @param node Permission node - * @param defaultValue Default value - * @return Value - */ - public double getGroupInfoDouble(World world, String group, String node, double defaultValue) { - return getGroupInfoDouble(world.getName(), group, node, defaultValue); - } - - /** - * Set a groups informational node (Double) value - * @param world World name - * @param group Group name - * @param node Permission node - * @param value Value to set - */ - abstract public void setGroupInfoDouble(String world, String group, String node, double value); - - /** - * Set a groups informational node (Double) value - * @param world World Object - * @param group Group name - * @param node Permission node - * @param value Value to set - */ - public void setGroupInfoDouble(World world, String group, String node, double value) { - setGroupInfoDouble(world.getName(), group, node, value); - } - - /** - * Get a players informational node (Boolean) value - * @param world World name - * @param player OfflinePlayer - * @param node Permission node - * @param defaultValue Default value - * @return Value - */ - public boolean getPlayerInfoBoolean(String world, OfflinePlayer player, String node, boolean defaultValue) { - return getPlayerInfoBoolean(world, player.getName(), node, defaultValue); - } - - /** - * @deprecated As of VaultAPI 1.4 use {{@link #getPlayerInfoBoolean(String, OfflinePlayer, String, boolean)} instead. - * - * Get a players informational node (Boolean) value - * @param world World name - * @param player Player name - * @param node Permission node - * @param defaultValue Default value - * @return Value - */ - @Deprecated - abstract public boolean getPlayerInfoBoolean(String world, String player, String node, boolean defaultValue); - - /** - * @deprecated As of VaultAPI 1.4 use {{@link #getPlayerInfoBoolean(String, OfflinePlayer, String, boolean)} instead. - * - * Get a players informational node (Boolean) value - * @param world World Object - * @param player Player name - * @param node Permission node - * @param defaultValue Default value - * @return Value - */ - @Deprecated - public boolean getPlayerInfoBoolean(World world, String player, String node, boolean defaultValue) { - return getPlayerInfoBoolean(world.getName(), player, node, defaultValue); - } - - /** - * Get a players informational node (Boolean) value - * @param player Player Object - * @param node Permission node - * @param defaultValue Default value - * @return Value - */ - public boolean getPlayerInfoBoolean(Player player, String node, boolean defaultValue) { - return getPlayerInfoBoolean(player.getWorld().getName(), player, node, defaultValue); - } - - /** - * Set a players informational node (Boolean) value - * @param world World name - * @param player OfflinePlayer - * @param node Permission node - * @param value Value to set - */ - public void setPlayerInfoBoolean(String world, OfflinePlayer player, String node, boolean value) { - setPlayerInfoBoolean(world, player.getName(), node, value); - } - - /** - * @deprecated As of VaultAPI 1.4 use {{@link #setPlayerInfoBoolean(String, OfflinePlayer, String, boolean)} instead. - * Set a players informational node (Boolean) value - * @param world World name - * @param player Player name - * @param node Permission node - * @param value Value to set - */ - @Deprecated - abstract public void setPlayerInfoBoolean(String world, String player, String node, boolean value); - - /** - * @deprecated As of VaultAPI 1.4 use {{@link #setPlayerInfoBoolean(String, OfflinePlayer, String, boolean)} instead. - * Set a players informational node (Boolean) value - * @param world World Object - * @param player Player name - * @param node Permission node - * @param value Value to set - */ - @Deprecated - public void setPlayerInfoBoolean(World world, String player, String node, boolean value) { - setPlayerInfoBoolean(world.getName(), player, node, value); - } - - /** - * Set a players informational node (Boolean) value - * @param player Player Object - * @param node Permission node - * @param value Value to set - */ - public void setPlayerInfoBoolean(Player player, String node, boolean value) { - setPlayerInfoBoolean(player.getWorld().getName(), player, node, value); - } - - /** - * Get a groups informational node (Boolean) value - * @param world Name of World - * @param group Name of Group - * @param node Permission node - * @param defaultValue Default value - * @return Value - */ - abstract public boolean getGroupInfoBoolean(String world, String group, String node, boolean defaultValue); - - /** - * Set a players informational node (Boolean) value - * @param world World Object - * @param group Group name - * @param node Permission node - * @param defaultValue Default value - * @return Value - */ - public boolean getGroupInfoBoolean(World world, String group, String node, boolean defaultValue) { - return getGroupInfoBoolean(world.getName(), group, node, defaultValue); - } - - /** - * Set a groups informational node (Boolean) value - * @param world World name - * @param group Group name - * @param node Permission node - * @param value Value to set - */ - abstract public void setGroupInfoBoolean(String world, String group, String node, boolean value); - - /** - * Set a players informational node (Boolean) value - * @param world World Object - * @param group Group name - * @param node Permission node - * @param value Value to set - */ - public void setGroupInfoBoolean(World world, String group, String node, boolean value) { - setGroupInfoBoolean(world.getName(), group, node, value); - } - - /** - * Get a players informational node (String) value - * @param world World name - * @param player OfflinePlayer - * @param node Permission node - * @param defaultValue Default value - * @return Value - */ - public String getPlayerInfoString(String world, OfflinePlayer player, String node, String defaultValue) { - return getPlayerInfoString(world, player.getName(), node, defaultValue); - } - - /** - * @deprecated As of VaultAPI 1.4 use {{@link #getPlayerInfoString(String, OfflinePlayer, String, String)} instead. - * - * Get a players informational node (String) value - * @param world World name - * @param player Player name - * @param node Permission node - * @param defaultValue Default value - * @return Value - */ - @Deprecated - abstract public String getPlayerInfoString(String world, String player, String node, String defaultValue); - - /** - * @deprecated As of VaultAPI 1.4 use {{@link #getPlayerInfoString(String, OfflinePlayer, String, String)} instead. - * Get a players informational node (String) value - * @param world World Object - * @param player Player name - * @param node Permission node - * @param defaultValue Default value - * @return Value - */ - @Deprecated - public String getPlayerInfoString(World world, String player, String node, String defaultValue) { - return getPlayerInfoString(world.getName(), player, node, defaultValue); - } - - /** - * Get a players informational node (String) value - * @param player Player Object - * @param node Permission node - * @param defaultValue Default value - * @return Value - */ - public String getPlayerInfoString(Player player, String node, String defaultValue) { - return getPlayerInfoString(player.getWorld().getName(), player, node, defaultValue); - } - - /** - * Set a players informational node (String) value - * @param world World name - * @param player OfflinePlayer - * @param node Permission node - * @param value Value to set - */ - public void setPlayerInfoString(String world, OfflinePlayer player, String node, String value) { - setPlayerInfoString(world, player.getName(), node, value); - } - - /** - * @deprecated As of VaultAPI 1.4 use {{@link #setPlayerInfoString(String, OfflinePlayer, String, String)} instead. - * Set a players informational node (String) value - * @param world World name - * @param player Player name - * @param node Permission node - * @param value Value to set - */ - @Deprecated - abstract public void setPlayerInfoString(String world, String player, String node, String value); - - /** - * @deprecated As of VaultAPI 1.4 use {{@link #setPlayerInfoString(String, OfflinePlayer, String, String)} instead. - * Set a players informational node (String) value - * @param world World name - * @param player Player name - * @param node Permission node - * @param value Value to set - */ - @Deprecated - public void setPlayerInfoString(World world, String player, String node, String value) { - setPlayerInfoString(world.getName(), player, node, value); - } - - /** - * Set a players informational node (String) value - * @param player Player Object - * @param node Permission node - * @param value Value ot set - */ - public void setPlayerInfoString(Player player, String node, String value) { - setPlayerInfoString(player.getWorld().getName(), player, node, value); - } - - /** - * Get a groups informational node (String) value - * @param world Name of World - * @param group Name of Group - * @param node Permission node - * @param defaultValue Default value - * @return Value - */ - abstract public String getGroupInfoString(String world, String group, String node, String defaultValue); - - /** - * Set a players informational node (String) value - * @param world World Object - * @param group Group name - * @param node Permission node - * @param defaultValue Default value - * @return Value - */ - public String getGroupInfoString(World world, String group, String node, String defaultValue) { - return getGroupInfoString(world.getName(), group, node, defaultValue); - } - - /** - * Set a groups informational node (String) value - * @param world World name - * @param group Group name - * @param node Permission node - * @param value Value to set - */ - abstract public void setGroupInfoString(String world, String group, String node, String value); - - /** - * Set a groups informational node (String) value - * @param world World name - * @param group Group name - * @param node Permission node - * @param value Value to set - */ - public void setGroupInfoString(World world, String group, String node, String value) { - setGroupInfoString(world.getName(), group, node, value); - } - - /** - * Check if player is member of a group. - * @param world World name - * @param player OfflinePlayer - * @param group Group name - * @return Success or Failure - */ - public boolean playerInGroup(String world, OfflinePlayer player, String group) { - return perms.playerInGroup(world, player, group); - } - - /** - * @deprecated As of VaultAPI 1.4 use {{@link #playerInGroup(String, OfflinePlayer, String)} instead. - * Check if player is member of a group. - * @param world World name - * @param player Player name - * @param group Group name - * @return Success or Failure - */ - @Deprecated - public boolean playerInGroup(String world, String player, String group) { - return perms.playerInGroup(world, player, group); - } - - /** - * @deprecated As of VaultAPI 1.4 use {{@link #playerInGroup(String, OfflinePlayer, String)} instead. - * Check if player is member of a group. - * @param world World Object - * @param player Player name - * @param group Group name - * @return Success or Failure - */ - @Deprecated - public boolean playerInGroup(World world, String player, String group) { - return playerInGroup(world.getName(), player, group); - } - - /** - * Check if player is member of a group. - * @param player Player Object - * @param group Group name - * @return Success or Failure - */ - public boolean playerInGroup(Player player, String group) { - return playerInGroup(player.getWorld().getName(), player, group); - } - - /** - * Gets the list of groups that this player has - * @param world World name - * @param player OfflinePlayer - * @return Array of groups - */ - public String[] getPlayerGroups(String world, OfflinePlayer player) { - return perms.getPlayerGroups(world, player); - } - - /** - * @deprecated As of VaultAPI 1.4 use {{@link #getPlayerGroups(String, OfflinePlayer)} instead. - * Gets the list of groups that this player has - * @param world World name - * @param player Player name - * @return Array of groups - */ - @Deprecated - public String[] getPlayerGroups(String world, String player) { - return perms.getPlayerGroups(world, player); - } - - /** - * @deprecated As of VaultAPI 1.4 use {{@link #getPlayerGroups(String, OfflinePlayer)} instead. - * Gets the list of groups that this player has - * @param world World Object - * @param player Player name - * @return Array of groups - */ - @Deprecated - public String[] getPlayerGroups(World world, String player) { - return getPlayerGroups(world.getName(), player); - } - - /** - * Gets the list of groups that this player has - * @param player Player Object - * @return Array of groups - */ - public String[] getPlayerGroups(Player player) { - return getPlayerGroups(player.getWorld().getName(), player); - } - - /** - * Gets players primary group - * @param world World name - * @param player OfflinePlayer - * @return Players primary group - */ - public String getPrimaryGroup(String world, OfflinePlayer player) { - return perms.getPrimaryGroup(world, player); - } - - /** - * @deprecated As of VaultAPI 1.4 use {{@link #getPrimaryGroup(String, OfflinePlayer)} instead. - * Gets players primary group - * @param world World name - * @param player Player name - * @return Players primary group - */ - @Deprecated - public String getPrimaryGroup(String world, String player) { - return perms.getPrimaryGroup(world, player); - } - - /** - * @deprecated As of VaultAPI 1.4 use {{@link #getPrimaryGroup(String, OfflinePlayer)} instead. - * Gets players primary group - * @param world World Object - * @param player Player name - * @return Players primary group - */ - @Deprecated - public String getPrimaryGroup(World world, String player) { - return getPrimaryGroup(world.getName(), player); - } - - /** - * Get players primary group - * @param player Player Object - * @return Players primary group - */ - public String getPrimaryGroup(Player player) { - return getPrimaryGroup(player.getWorld().getName(), player); - } - - /** - * Returns a list of all known groups - * @return an Array of String of all groups - */ - public String[] getGroups() { - return perms.getGroups(); - } -} diff --git a/src/main/java/net/milkbowl/vault2/chat/ChatUnlocked.java b/src/main/java/net/milkbowl/vault2/chat/ChatUnlocked.java new file mode 100644 index 0000000..3c0584a --- /dev/null +++ b/src/main/java/net/milkbowl/vault2/chat/ChatUnlocked.java @@ -0,0 +1,146 @@ +package net.milkbowl.vault2.chat; +/* + 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 . + */ + +import net.milkbowl.vault2.helper.Context; +import net.milkbowl.vault2.helper.Subject; +import org.jetbrains.annotations.NotNull; + +import java.util.Optional; + +/** + * ChatUnlocked + * + * @author creatorfromhell + * @since 2.18 + */ +public interface ChatUnlocked { + + /** + * Checks whether this chat provider is enabled. + * + * @return true if the chat provider is enabled; false otherwise. + * @since 2.18 + */ + boolean isEnabled(); + + /** + * Retrieves the name of this chat provider. + * + * @return the name of the chat provider as a non-null string. + * @since 2.18 + */ + @NotNull + String getName(); + + /** + * Checks whether the chat provider supports group-based prefixes, suffices and info nodes. + * + * @return true if group-based prefixes, suffices and info nodes are supported; false otherwise. + * @since 2.18 + */ + boolean hasGroupSupport(); + + /** + * Retrieves the prefix for the specified subject within the given context. + * + * @param context the context in which the prefix is being retrieved; must not be null + * @param subject the subject whose prefix is to be retrieved; must not be null + * @return an optional containing the prefix if it exists, or an empty optional if no prefix is set + * @since 2.18 + */ + Optional getPrefix(@NotNull Context context, @NotNull Subject subject); + + /** + * Retrieves the suffix for the specified subject within the given context. + * + * @param context the context in which the suffix is being retrieved; must not be null + * @param subject the subject whose suffix is to be retrieved; must not be null + * @return an optional containing the suffix if it exists, or an empty optional if no suffix is set + * @since 2.18 + */ + Optional getSuffix(@NotNull Context context, @NotNull Subject subject); + + /** + * Sets the prefix for the specified subject within the given context. + * + * @param context the context in which the prefix is being set; must not be null + * @param subject the subject for which the prefix is being updated; must not be null + * @param prefix the new prefix to be assigned; must not be null + * @return true if the prefix was successfully set, false otherwise + * @since 2.18 + */ + boolean setPrefix(@NotNull Context context, @NotNull Subject subject, @NotNull String prefix); + + /** + * Sets the suffix for the specified subject within the given context. + * + * @param context the context in which the suffix is being set; must not be null + * @param subject the subject for which the suffix is being updated; must not be null + * @param suffix the new suffix to be assigned; must not be null + * @return true if the suffix was successfully set, false otherwise + * @since 2.18 + */ + boolean setSuffix(@NotNull Context context, @NotNull Subject subject, @NotNull String suffix); + + /** + * Retrieves the prefix for a specified group within a given context for the specified subject. + * + * @param context the context in which the group-based prefix is being retrieved; must not be null + * @param subject the subject for which the group-based prefix is being retrieved; must not be null + * @param group the group from which the prefix is being retrieved; must not be null + * @return an optional containing the prefix if it exists, or an empty optional if no prefix is set for the group + */ + Optional getGroupPrefix(@NotNull Context context, @NotNull Subject subject, @NotNull String group); + + /** + * Retrieves the suffix for a specified group within a given context for the specified subject. + * + * @param context the context in which the group-based suffix is being retrieved; must not be null + * @param subject the subject for which the group-based suffix is being retrieved; must not be null + * @param group the group from which the suffix is being retrieved; must not be null + * @return an optional containing the suffix if it exists, or an empty optional if no suffix is set for the group + * @since 2.18 + */ + Optional getGroupSuffix(@NotNull Context context, @NotNull Subject subject, @NotNull String group); + + /** + * Sets the prefix for a specific group within a given context for the specified subject. + * + * @param context the context in which the group-based prefix is being set; must not be null + * @param subject the subject for which the group-based prefix is being updated; must not be null + * @param group the group to which the prefix applies; must not be null + * @param prefix the new prefix to be assigned to the group; must not be null + * @return true if the prefix was successfully set for the group, false otherwise + * @since 2.18 + */ + boolean setGroupPrefix(@NotNull Context context, @NotNull Subject subject, @NotNull String group, + @NotNull String prefix); + + /** + * Sets the suffix for a specific group within a given context for the specified subject. + * + * @param context the context in which the group-based suffix is being set; must not be null + * @param subject the subject for which the group-based suffix is being updated; must not be null + * @param group the group to which the suffix applies; must not be null + * @param suffix the new suffix to be assigned to the group; must not be null + * @return true if the suffix was successfully set for the group, false otherwise + * @since 2.18 + */ + boolean setGroupSuffix(@NotNull Context context, @NotNull Subject subject, @NotNull String group, + @NotNull String suffix); +} \ No newline at end of file diff --git a/src/main/java/net/milkbowl/vault2/helper/Context.java b/src/main/java/net/milkbowl/vault2/helper/Context.java index 215121d..f45e4b4 100644 --- a/src/main/java/net/milkbowl/vault2/helper/Context.java +++ b/src/main/java/net/milkbowl/vault2/helper/Context.java @@ -18,6 +18,8 @@ import org.jetbrains.annotations.Nullable; +import java.util.Optional; + /** * Represents a context within which certain operations or data are scoped. * A context can optionally be tied to a specific world. @@ -38,8 +40,7 @@ public Context(@Nullable final String world) { this.world = world; } - @Nullable - public String world() { - return world; + public Optional world() { + return Optional.ofNullable(world); } } \ No newline at end of file diff --git a/src/main/java/net/milkbowl/vault2/helper/Subject.java b/src/main/java/net/milkbowl/vault2/helper/Subject.java index af186ce..00d531f 100644 --- a/src/main/java/net/milkbowl/vault2/helper/Subject.java +++ b/src/main/java/net/milkbowl/vault2/helper/Subject.java @@ -19,6 +19,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.Optional; import java.util.UUID; /** @@ -50,8 +51,8 @@ public UUID identifier() { } @Nullable - public String name() { - return name; + public Optional name() { + return Optional.ofNullable(name); } public boolean isPlayer() { From 47878ee110e963914214b4fa2b1300e2dbd08822 Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Fri, 9 Jan 2026 22:53:57 -0500 Subject: [PATCH 92/95] Refactor group-related methods in `Permission` and `Chat` APIs for consistency. - Standardized method signatures by removing redundant `Subject` parameters. - Improved documentation for clarity and usability. - Added new constructors and utilities in `Context` and `Subject` classes. --- .../milkbowl/vault2/chat/ChatUnlocked.java | 22 +++----- .../net/milkbowl/vault2/helper/Context.java | 16 ++++-- .../net/milkbowl/vault2/helper/Subject.java | 12 ++++ .../vault2/permission/PermissionUnlocked.java | 56 ++++++++++++------- 4 files changed, 67 insertions(+), 39 deletions(-) diff --git a/src/main/java/net/milkbowl/vault2/chat/ChatUnlocked.java b/src/main/java/net/milkbowl/vault2/chat/ChatUnlocked.java index 3c0584a..c5b399e 100644 --- a/src/main/java/net/milkbowl/vault2/chat/ChatUnlocked.java +++ b/src/main/java/net/milkbowl/vault2/chat/ChatUnlocked.java @@ -98,49 +98,43 @@ public interface ChatUnlocked { boolean setSuffix(@NotNull Context context, @NotNull Subject subject, @NotNull String suffix); /** - * Retrieves the prefix for a specified group within a given context for the specified subject. + * Retrieves the prefix for a specified group within a given context. * * @param context the context in which the group-based prefix is being retrieved; must not be null - * @param subject the subject for which the group-based prefix is being retrieved; must not be null * @param group the group from which the prefix is being retrieved; must not be null * @return an optional containing the prefix if it exists, or an empty optional if no prefix is set for the group */ - Optional getGroupPrefix(@NotNull Context context, @NotNull Subject subject, @NotNull String group); + Optional getGroupPrefix(@NotNull Context context, @NotNull String group); /** - * Retrieves the suffix for a specified group within a given context for the specified subject. + * Retrieves the suffix for a specified group within a given context. * * @param context the context in which the group-based suffix is being retrieved; must not be null - * @param subject the subject for which the group-based suffix is being retrieved; must not be null * @param group the group from which the suffix is being retrieved; must not be null * @return an optional containing the suffix if it exists, or an empty optional if no suffix is set for the group * @since 2.18 */ - Optional getGroupSuffix(@NotNull Context context, @NotNull Subject subject, @NotNull String group); + Optional getGroupSuffix(@NotNull Context context, @NotNull String group); /** - * Sets the prefix for a specific group within a given context for the specified subject. + * Sets the prefix for a specific group within a given context. * * @param context the context in which the group-based prefix is being set; must not be null - * @param subject the subject for which the group-based prefix is being updated; must not be null * @param group the group to which the prefix applies; must not be null * @param prefix the new prefix to be assigned to the group; must not be null * @return true if the prefix was successfully set for the group, false otherwise * @since 2.18 */ - boolean setGroupPrefix(@NotNull Context context, @NotNull Subject subject, @NotNull String group, - @NotNull String prefix); + boolean setGroupPrefix(@NotNull Context context, @NotNull String group, @NotNull String prefix); /** - * Sets the suffix for a specific group within a given context for the specified subject. + * Sets the suffix for a specific group within a given context. * * @param context the context in which the group-based suffix is being set; must not be null - * @param subject the subject for which the group-based suffix is being updated; must not be null * @param group the group to which the suffix applies; must not be null * @param suffix the new suffix to be assigned to the group; must not be null * @return true if the suffix was successfully set for the group, false otherwise * @since 2.18 */ - boolean setGroupSuffix(@NotNull Context context, @NotNull Subject subject, @NotNull String group, - @NotNull String suffix); + boolean setGroupSuffix(@NotNull Context context, @NotNull String group, @NotNull String suffix); } \ No newline at end of file diff --git a/src/main/java/net/milkbowl/vault2/helper/Context.java b/src/main/java/net/milkbowl/vault2/helper/Context.java index f45e4b4..651ef65 100644 --- a/src/main/java/net/milkbowl/vault2/helper/Context.java +++ b/src/main/java/net/milkbowl/vault2/helper/Context.java @@ -21,12 +21,13 @@ import java.util.Optional; /** - * Represents a context within which certain operations or data are scoped. - * A context can optionally be tied to a specific world. + * Represents an operational context that can optionally be associated with a specific world. + * The context determines the scope in which certain operations or checks, such as permissions, are applied. * - * This class provides functionality to retrieve the name of the world associated - * with this context, or operate within a global, world-less context if no specific - * world is supplied. + * A global context is represented by the {@code GLOBAL} constant, which is not tied to any specific world. + * + * This class provides methods for retrieving the name of the world associated with the context, + * if any, and is used to manage scoped operations. * @author creatorfromhell * @since 2.18 */ @@ -36,6 +37,11 @@ public class Context { private String world; + /** + * Constructs a new Context object, optionally associated with a specific world. + * + * @param world the name of the world to associate with this context, or null for a global context + */ public Context(@Nullable final String world) { this.world = world; } diff --git a/src/main/java/net/milkbowl/vault2/helper/Subject.java b/src/main/java/net/milkbowl/vault2/helper/Subject.java index 00d531f..0a26de9 100644 --- a/src/main/java/net/milkbowl/vault2/helper/Subject.java +++ b/src/main/java/net/milkbowl/vault2/helper/Subject.java @@ -38,6 +38,18 @@ public class Subject { private String name; private boolean player; + /** + * Constructs a new Subject with the specified identifier and name, defaulting + * the player flag to true. + * + * @param identifier the unique identifier for the subject + * @param name the name of the subject + */ + public Subject(final UUID identifier, final String name) { + + this(identifier, name, true); + } + public Subject(final UUID identifier, final String name, final boolean player) { this.identifier = identifier; diff --git a/src/main/java/net/milkbowl/vault2/permission/PermissionUnlocked.java b/src/main/java/net/milkbowl/vault2/permission/PermissionUnlocked.java index 75c3ae4..36bfca8 100644 --- a/src/main/java/net/milkbowl/vault2/permission/PermissionUnlocked.java +++ b/src/main/java/net/milkbowl/vault2/permission/PermissionUnlocked.java @@ -214,6 +214,17 @@ CompletableFuture setTransientPermissionAsync(@NotNull Context context, */ boolean inGroup(@NotNull Context context, @NotNull Subject subject); + /** + * Determines whether the specified subject belongs to the given group within the provided context. + * + * @param context the context in which the group membership is being checked, must not be null + * @param subject the subject whose membership is being verified, must not be null + * @param group the name of the group to check for membership, must not be null + * @return true if the subject belongs to the specified group in the given context, false otherwise + * @since 2.18 + */ + boolean inGroup(@NotNull Context context, @NotNull Subject subject, @NotNull String group); + /** * Asynchronously checks if the specified subject is part of a group in the given context. * @@ -225,6 +236,18 @@ CompletableFuture setTransientPermissionAsync(@NotNull Context context, @NotNull CompletableFuture inGroupAsync(@NotNull Context context, @NotNull Subject subject); + /** + * Asynchronously checks if the given subject is part of the specified group within the provided context. + * + * @param context the context in which the group membership should be checked, must not be null + * @param subject the subject whose group membership is to be verified, must not be null + * @param group the name of the group to check membership against, must not be null + * @return a CompletableFuture that will complete with a Boolean indicating whether the subject is in the group + * @since 2.18 + */ + @NotNull + CompletableFuture inGroupAsync(@NotNull Context context, @NotNull Subject subject, @NotNull String group); + /** * Assigns the specified subject to a given group within the provided context. * @@ -274,10 +297,9 @@ CompletableFuture removeGroupAsync(@NotNull Context context, @NotNull S @NotNull String group); /** - * Checks whether the specified group has the given permission for a subject within the context. + * Checks whether the specified group has the given permission within the context. * * @param context the context in which the group permission is being checked; cannot be null - * @param subject the subject for whom the group permission is being checked; cannot be null * @param group the name of the group whose permission is being checked; cannot be null * @param permission the specific permission identifier to be checked; cannot be null * @return a {@link TriState} value indicating the state of the permission for the group, @@ -285,14 +307,12 @@ CompletableFuture removeGroupAsync(@NotNull Context context, @NotNull S * @since 2.18 */ @NotNull - TriState groupHas(@NotNull Context context, @NotNull Subject subject, @NotNull String group, - @NotNull String permission); + TriState groupHas(@NotNull Context context, @NotNull String group, @NotNull String permission); /** - * Checks if a specific group has a given permission for a subject within a provided context. + * Checks if a specific group has a given permission within a provided context. * * @param context the context in which the check is performed; must not be null - * @param subject the subject for which the group's permission is being checked; must not be null * @param group the name of the group being checked; must not be null * @param permission the permission being checked for the group; must not be null * @return a CompletableFuture that resolves to a TriState, indicating whether the group has the @@ -300,29 +320,27 @@ TriState groupHas(@NotNull Context context, @NotNull Subject subject, @NotNull S * @since 2.18 */ @NotNull - CompletableFuture groupHasAsync(@NotNull Context context, @NotNull Subject subject, - @NotNull String group, @NotNull String permission); + CompletableFuture groupHasAsync(@NotNull Context context, @NotNull String group, + @NotNull String permission); /** - * Sets the specified permission for a subject in a given group within a specified context to a desired state. + * Sets the specified permission in a given group within a specified context to a desired state. * * @param context the context in which the group permission is being set; cannot be null - * @param subject the subject for whom the group permission is being set; cannot be null * @param group the name of the group for which the permission is assigned; cannot be null * @param permission the identifier of the permission to modify; cannot be null * @param value the {@link TriState} value indicating the desired state of the permission; cannot be null * @return true if the permission was successfully set for the group, false otherwise * @since 2.18 */ - boolean groupSetPermission(@NotNull Context context, @NotNull Subject subject, @NotNull String group, + boolean groupSetPermission(@NotNull Context context, @NotNull String group, @NotNull String permission, @NotNull TriState value); /** - * Sets a specific permission for a group associated with a given subject in the provided context. + * Sets a specific permission for a group associated in the provided context. * The permission's state can be set to true, false, or undefined using the TriState value. * * @param context the context in which the group and subject operate, must not be null - * @param subject the subject for which the permission is being set, must not be null * @param group the name of the group for which the permission is being set, must not be null * @param permission the permission string to be set for the group, must not be null * @param value the TriState value representing the desired state of the permission (true, false, or undefined), must not be null @@ -330,31 +348,29 @@ boolean groupSetPermission(@NotNull Context context, @NotNull Subject subject, @ * @since 2.18 */ @NotNull - CompletableFuture groupSetPermissionAsync(@NotNull Context context, @NotNull Subject subject, + CompletableFuture groupSetPermissionAsync(@NotNull Context context, @NotNull String group, @NotNull String permission, @NotNull TriState value); /** - * Sets a transient permission for a specific group within a given context and subject. + * Sets a transient permission for a specific group within a given context. * Transient permissions are temporary and do not persist beyond the current runtime. * * @param context the context in which the permission is being set; cannot be null - * @param subject the subject for whom the group permission is being set; cannot be null * @param group the name of the group for which the transient permission is assigned; cannot be null * @param permission the identifier of the permission to modify; cannot be null * @param value the {@link TriState} value indicating the desired state of the permission; cannot be null * @return true if the transient permission was successfully set for the group, false otherwise * @since 2.18 */ - boolean groupSetTransientPermission(@NotNull Context context, @NotNull Subject subject, @NotNull String group, + boolean groupSetTransientPermission(@NotNull Context context, @NotNull String group, @NotNull String permission, @NotNull TriState value); /** - * Sets a transient permission for a specific group within the given subject and context. + * Sets a transient permission for a specific group within the given context. * The permission will only exist for the duration of the running session and is not persisted. * * @param context the context in which the permission should be applied, must not be null - * @param subject the subject to which the permission is being applied, must not be null * @param group the name of the group the permission applies to, must not be null * @param permission the specific permission to be set, must not be null * @param value the value of the permission, represented by TriState, must not be null @@ -362,7 +378,7 @@ boolean groupSetTransientPermission(@NotNull Context context, @NotNull Subject s * @since 2.18 */ @NotNull - CompletableFuture groupSetTransientPermissionAsync(@NotNull Context context, @NotNull Subject subject, + CompletableFuture groupSetTransientPermissionAsync(@NotNull Context context, @NotNull String group, @NotNull String permission, @NotNull TriState value); } \ No newline at end of file From 374b22bf4a2ffe0b5d3b3d3183fd889159497f5e Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Fri, 9 Jan 2026 23:05:25 -0500 Subject: [PATCH 93/95] Make `Subject` fields immutable and add `fromPlayer` factory method. --- src/main/java/net/milkbowl/vault2/helper/Subject.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/milkbowl/vault2/helper/Subject.java b/src/main/java/net/milkbowl/vault2/helper/Subject.java index 0a26de9..144375c 100644 --- a/src/main/java/net/milkbowl/vault2/helper/Subject.java +++ b/src/main/java/net/milkbowl/vault2/helper/Subject.java @@ -16,6 +16,7 @@ along with Vault. If not, see . */ +import org.bukkit.OfflinePlayer; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -34,9 +35,9 @@ */ public class Subject { - private UUID identifier; - private String name; - private boolean player; + private final UUID identifier; + private final String name; + private final boolean player; /** * Constructs a new Subject with the specified identifier and name, defaulting @@ -70,4 +71,8 @@ public Optional name() { public boolean isPlayer() { return player; } + + public static Subject fromPlayer(final OfflinePlayer player) { + return new Subject(player.getUniqueId(), player.getName(), true); + } } \ No newline at end of file From 8c2c1649ecea997815aa6f7fa93056286054e313 Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Sat, 10 Jan 2026 15:00:16 -0500 Subject: [PATCH 94/95] Add context and subject enhancements, new async operations, and documentation. - Refactored `Context` and `Subject` APIs, introducing enums `SubjectType` and `LookupMode`. - Added new async methods for permission and chat operations, including `copyPermissionsAsync`, `getPrefixAsync`, and more. - Improved context handling with `ContextKeys` and new utilities like `fromWorld`. - Enhanced method documentation for better usability and clarity. --- .../milkbowl/vault2/chat/ChatUnlocked.java | 206 +++++++++++++++--- .../net/milkbowl/vault2/chat/InfoKey.java | 54 +++++ .../net/milkbowl/vault2/helper/Context.java | 52 ----- .../net/milkbowl/vault2/helper/Subject.java | 78 ------- .../vault2/helper/context/Context.java | 155 +++++++++++++ .../vault2/helper/context/ContextKeys.java | 36 +++ .../vault2/helper/context/LookupMode.java | 33 +++ .../vault2/helper/subject/Subject.java | 111 ++++++++++ .../vault2/helper/subject/SubjectType.java | 32 +++ .../vault2/permission/PermissionUnlocked.java | 61 +++++- 10 files changed, 657 insertions(+), 161 deletions(-) create mode 100644 src/main/java/net/milkbowl/vault2/chat/InfoKey.java delete mode 100644 src/main/java/net/milkbowl/vault2/helper/Context.java delete mode 100644 src/main/java/net/milkbowl/vault2/helper/Subject.java create mode 100644 src/main/java/net/milkbowl/vault2/helper/context/Context.java create mode 100644 src/main/java/net/milkbowl/vault2/helper/context/ContextKeys.java create mode 100644 src/main/java/net/milkbowl/vault2/helper/context/LookupMode.java create mode 100644 src/main/java/net/milkbowl/vault2/helper/subject/Subject.java create mode 100644 src/main/java/net/milkbowl/vault2/helper/subject/SubjectType.java diff --git a/src/main/java/net/milkbowl/vault2/chat/ChatUnlocked.java b/src/main/java/net/milkbowl/vault2/chat/ChatUnlocked.java index c5b399e..ea22c7f 100644 --- a/src/main/java/net/milkbowl/vault2/chat/ChatUnlocked.java +++ b/src/main/java/net/milkbowl/vault2/chat/ChatUnlocked.java @@ -16,15 +16,18 @@ along with Vault. If not, see . */ -import net.milkbowl.vault2.helper.Context; -import net.milkbowl.vault2.helper.Subject; +import net.milkbowl.vault2.helper.context.Context; +import net.milkbowl.vault2.helper.subject.Subject; import org.jetbrains.annotations.NotNull; import java.util.Optional; +import java.util.concurrent.CompletableFuture; /** - * ChatUnlocked - * + * Represents a chat provider that allows customization and management of prefixes, + * suffixes, and related information for both individual subjects and groups within + * a specified context. This interface provides methods to retrieve and modify these + * properties, as well as to check for feature support for group-based metadata. * @author creatorfromhell * @since 2.18 */ @@ -48,9 +51,9 @@ public interface ChatUnlocked { String getName(); /** - * Checks whether the chat provider supports group-based prefixes, suffices and info nodes. + * Checks whether the chat provider supports group-based prefixes, suffixes, and info nodes. * - * @return true if group-based prefixes, suffices and info nodes are supported; false otherwise. + * @return true if group-based prefixes, suffixes and info nodes are supported; false otherwise. * @since 2.18 */ boolean hasGroupSupport(); @@ -65,6 +68,32 @@ public interface ChatUnlocked { */ Optional getPrefix(@NotNull Context context, @NotNull Subject subject); + /** + * Asynchronously retrieves the prefix associated with the given subject in the specified context. + * The computation is executed asynchronously and returns a {@code CompletableFuture} containing + * an {@code Optional} with the prefix, or an empty {@code Optional} if no prefix is set. + * + * @param context the context in which the prefix is being retrieved; must not be null + * @param subject the subject whose prefix is to be retrieved; must not be null + * @return a {@code CompletableFuture} containing an {@code Optional} with the prefix if it exists, + * or an empty {@code Optional} if no prefix is set + * @since 2.18 + */ + CompletableFuture> getPrefixAsync(@NotNull Context context, @NotNull Subject subject); + + /** + * Retrieves the prefix for the specified subject within the provided context, or null if no prefix exists. + * + * @param context the context in which the prefix is being retrieved; must not be null + * @param subject the subject whose prefix is to be retrieved; must not be null + * @return the prefix as a string if it exists, or null if no prefix is set + * @since 2.18 + */ + default String getPrefixOrNull(@NotNull final Context context, @NotNull final Subject subject) { + return getPrefix(context, subject).orElse(null); + } + + /** * Retrieves the suffix for the specified subject within the given context. * @@ -75,6 +104,30 @@ public interface ChatUnlocked { */ Optional getSuffix(@NotNull Context context, @NotNull Subject subject); + /** + * Asynchronously retrieves the suffix associated with the provided subject + * within the given context. + * + * @param context the context in which to look up the suffix; must not be null + * @param subject the subject for which the suffix is to be retrieved; must not be null + * @return a CompletableFuture that resolves to an Optional containing the suffix, + * or an empty Optional if no suffix is found + * @since 2.18 + */ + CompletableFuture> getSuffixAsync(@NotNull Context context, @NotNull Subject subject); + + /** + * Retrieves the suffix for the specified subject in the provided context, or returns null if not available. + * + * @param context the context in which the suffix is being retrieved, must not be null + * @param subject the subject for which the suffix is being retrieved, must not be null + * @return the suffix as a string if available, or null if no suffix is present + * @since 2.18 + */ + default String getSuffixOrNull(@NotNull final Context context, @NotNull final Subject subject) { + return getSuffix(context, subject).orElse(null); + } + /** * Sets the prefix for the specified subject within the given context. * @@ -86,6 +139,40 @@ public interface ChatUnlocked { */ boolean setPrefix(@NotNull Context context, @NotNull Subject subject, @NotNull String prefix); + /** + * Asynchronously sets a prefix for a given subject within a specified context. + * + * @param context the context in which the prefix is being set, must not be null + * @param subject the subject for which the prefix is being set, must not be null + * @param prefix the prefix value to be set, must not be null + * @return a CompletableFuture that resolves to a Boolean indicating whether + * the operation was successful + * @since 2.18 + */ + CompletableFuture setPrefixAsync(@NotNull Context context, @NotNull Subject subject, @NotNull String prefix); + + /** + * Copies the prefix from one subject to another within a given context. + * + * @param context the context in which the operation is performed, must not be null + * @param from the subject from which the prefix will be copied, must not be null + * @param to the subject to which the prefix will be applied, must not be null + * @return true if the prefix was successfully copied, false otherwise + * @since 2.18 + */ + boolean copyPrefix(@NotNull Context context, @NotNull Subject from, @NotNull Subject to); + + /** + * Asynchronously copies the prefix from one subject to another within the given context. + * + * @param context the context in which the operation is performed; must not be null + * @param from the subject from which the prefix will be copied; must not be null + * @param to the subject to which the prefix will be copied; must not be null + * @return a CompletableFuture that completes with {@code true} if the prefix was successfully copied, or {@code false} otherwise + * @since 2.18 + */ + CompletableFuture copyPrefixAsync(@NotNull Context context, @NotNull Subject from, @NotNull Subject to); + /** * Sets the suffix for the specified subject within the given context. * @@ -98,43 +185,106 @@ public interface ChatUnlocked { boolean setSuffix(@NotNull Context context, @NotNull Subject subject, @NotNull String suffix); /** - * Retrieves the prefix for a specified group within a given context. + * Asynchronously sets a suffix for the given subject within the specified context. + * + * @param context the context in which the suffix should be applied, must not be null + * @param subject the subject to which the suffix will be assigned, must not be null + * @param suffix the suffix to assign to the subject, must not be null + * @return a CompletableFuture that resolves to a Boolean indicating whether the operation was successful + * @since 2.18 + */ + CompletableFuture setSuffixAsync(@NotNull Context context, @NotNull Subject subject, @NotNull String suffix); + + /** + * Copies the suffix from one subject to another within the given context. + * + * @param context the context in which the operation is performed, must not be null + * @param from the subject from which the suffix will be copied, must not be null + * @param to the subject to which the suffix will be added, must not be null + * @return true if the suffix was successfully copied, false otherwise + * @since 2.18 + */ + boolean copySuffix(@NotNull Context context, @NotNull Subject from, @NotNull Subject to); + + /** + * Asynchronously copies the suffix from one subject to another in the provided context. * - * @param context the context in which the group-based prefix is being retrieved; must not be null - * @param group the group from which the prefix is being retrieved; must not be null - * @return an optional containing the prefix if it exists, or an empty optional if no prefix is set for the group + * @param context the context in which the suffix copy operation is performed, must not be null + * @param from the source subject from which the suffix is copied, must not be null + * @param to the target subject to which the suffix is copied, must not be null + * @return a CompletableFuture that completes with true if the suffix was successfully copied, + * or false if the operation failed + * @since 2.18 + */ + CompletableFuture copySuffixAsync(@NotNull Context context, @NotNull Subject from, @NotNull Subject to); + + /** + * Retrieves the value associated with the specified key for the given subject within the provided context. + * + * @param the type of the value to be retrieved + * @param context the context in which the value is being retrieved; must not be null + * @param subject the subject for which the value is being retrieved; must not be null + * @param key the key identifying the value to be retrieved; must not be null + * @return an {@code Optional} containing the value associated with the provided key if it exists; otherwise, an empty {@code Optional} + * @since 2.18 + */ + Optional get(final Context context, final Subject subject, final InfoKey key); + + /** + * Retrieves an asynchronous result wrapped in a {@link CompletableFuture}. + * The result contains an {@link Optional} object that may hold the value corresponding + * to the specified {@link InfoKey}. + * + * @param The type of the value associated with the given {@link InfoKey}. + * @param context The context in which the asynchronous operation is executed. + * @param subject The subject associated with the requested operation. + * @param key The key that identifies the specific data to be retrieved. + * @return A {@link CompletableFuture} that completes with an {@link Optional} containing + * the result, or an empty {@link Optional} if the value is not present. + * @since 2.18 */ - Optional getGroupPrefix(@NotNull Context context, @NotNull String group); + CompletableFuture> getAsync(final Context context, final Subject subject, final InfoKey key); /** - * Retrieves the suffix for a specified group within a given context. + * Retrieves the value associated with the specified key for the given subject within the provided context. + * If no value is found, the provided default value is returned. * - * @param context the context in which the group-based suffix is being retrieved; must not be null - * @param group the group from which the suffix is being retrieved; must not be null - * @return an optional containing the suffix if it exists, or an empty optional if no suffix is set for the group + * @param the type of the value to be retrieved + * @param context the context in which the value is being retrieved; must not be null + * @param subject the subject for which the value is being retrieved; must not be null + * @param key the key identifying the value to be retrieved; must not be null + * @param defaultValue the default value to return if no value is found; must not be null + * @return the value associated with the provided key if it exists; otherwise, the specified default value * @since 2.18 */ - Optional getGroupSuffix(@NotNull Context context, @NotNull String group); + default T getOrDefault(final Context context, final Subject subject, final InfoKey key, final T defaultValue) { + final Optional value = get(context, subject, key); + return value.orElse(defaultValue); + } /** - * Sets the prefix for a specific group within a given context. + * Sets the value associated with a specific key for a given subject in the specified context. * - * @param context the context in which the group-based prefix is being set; must not be null - * @param group the group to which the prefix applies; must not be null - * @param prefix the new prefix to be assigned to the group; must not be null - * @return true if the prefix was successfully set for the group, false otherwise + * @param the type of the value to be set + * @param context the context in which the operation is performed; must not be null + * @param subject the subject for which the value is being set; must not be null + * @param key the key identifying the value to be set; must not be null + * @param value the new value to associate with the given key; must not be null + * @return true if the value was successfully set, false otherwise * @since 2.18 */ - boolean setGroupPrefix(@NotNull Context context, @NotNull String group, @NotNull String prefix); + boolean set(final Context context, final Subject subject, final InfoKey key, final T value); /** - * Sets the suffix for a specific group within a given context. + * Asynchronously sets a value in the specified context for the given subject and key. * - * @param context the context in which the group-based suffix is being set; must not be null - * @param group the group to which the suffix applies; must not be null - * @param suffix the new suffix to be assigned to the group; must not be null - * @return true if the suffix was successfully set for the group, false otherwise + * @param context the context in which the value should be set + * @param subject the subject for which the value is being set + * @param key the key associated with the value to be set + * @param value the value to be set + * @param the type of the value + * @return a CompletableFuture that resolves to a Boolean indicating whether the operation was successful * @since 2.18 */ - boolean setGroupSuffix(@NotNull Context context, @NotNull String group, @NotNull String suffix); + CompletableFuture setAsync(final Context context, final Subject subject, final InfoKey key, final T value); } \ No newline at end of file diff --git a/src/main/java/net/milkbowl/vault2/chat/InfoKey.java b/src/main/java/net/milkbowl/vault2/chat/InfoKey.java new file mode 100644 index 0000000..28b7ca8 --- /dev/null +++ b/src/main/java/net/milkbowl/vault2/chat/InfoKey.java @@ -0,0 +1,54 @@ +package net.milkbowl.vault2.chat; +/* + 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 . + */ + +/** + * Represents a key structure used to store and organize information. + * This class supports generic typing to accommodate different data types. + * + * @param the type of the value associated with this key + * @author creatorfromhell + * @since 2.18 + */ +public class InfoKey { + + private final String node; + + public InfoKey(final String node) { + this.node = node; + } + + public String node() { + return node; + } + + public static InfoKey stringKey(final String node) { + return new InfoKey<>(node); + } + + public static InfoKey boolKey(final String node) { + return new InfoKey<>(node); + } + + public static InfoKey intKey(final String node) { + return new InfoKey<>(node); + } + + public static InfoKey doubleKey(final String node) { + return new InfoKey<>(node); + } +} \ No newline at end of file diff --git a/src/main/java/net/milkbowl/vault2/helper/Context.java b/src/main/java/net/milkbowl/vault2/helper/Context.java deleted file mode 100644 index 651ef65..0000000 --- a/src/main/java/net/milkbowl/vault2/helper/Context.java +++ /dev/null @@ -1,52 +0,0 @@ -package net.milkbowl.vault2.helper; -/* - 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 . - */ - -import org.jetbrains.annotations.Nullable; - -import java.util.Optional; - -/** - * Represents an operational context that can optionally be associated with a specific world. - * The context determines the scope in which certain operations or checks, such as permissions, are applied. - * - * A global context is represented by the {@code GLOBAL} constant, which is not tied to any specific world. - * - * This class provides methods for retrieving the name of the world associated with the context, - * if any, and is used to manage scoped operations. - * @author creatorfromhell - * @since 2.18 - */ -public class Context { - - public static final Context GLOBAL = new Context(null); - - private String world; - - /** - * Constructs a new Context object, optionally associated with a specific world. - * - * @param world the name of the world to associate with this context, or null for a global context - */ - public Context(@Nullable final String world) { - this.world = world; - } - - public Optional world() { - return Optional.ofNullable(world); - } -} \ No newline at end of file diff --git a/src/main/java/net/milkbowl/vault2/helper/Subject.java b/src/main/java/net/milkbowl/vault2/helper/Subject.java deleted file mode 100644 index 144375c..0000000 --- a/src/main/java/net/milkbowl/vault2/helper/Subject.java +++ /dev/null @@ -1,78 +0,0 @@ -package net.milkbowl.vault2.helper; -/* - 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 . - */ - -import org.bukkit.OfflinePlayer; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.Optional; -import java.util.UUID; - -/** - * Represents a subject with a unique identifier, a name, and a flag indicating - * whether the subject is a player. - * - * This class provides methods to retrieve the subject's identifier and name, - * with additional metadata annotations to indicate nullability. - * - * @author creatorfromhell - * @since 2.18 - */ -public class Subject { - - private final UUID identifier; - private final String name; - private final boolean player; - - /** - * Constructs a new Subject with the specified identifier and name, defaulting - * the player flag to true. - * - * @param identifier the unique identifier for the subject - * @param name the name of the subject - */ - public Subject(final UUID identifier, final String name) { - - this(identifier, name, true); - } - - public Subject(final UUID identifier, final String name, final boolean player) { - - this.identifier = identifier; - this.name = name; - this.player = player; - } - - @NotNull - public UUID identifier() { - return identifier; - } - - @Nullable - public Optional name() { - return Optional.ofNullable(name); - } - - public boolean isPlayer() { - return player; - } - - public static Subject fromPlayer(final OfflinePlayer player) { - return new Subject(player.getUniqueId(), player.getName(), true); - } -} \ No newline at end of file diff --git a/src/main/java/net/milkbowl/vault2/helper/context/Context.java b/src/main/java/net/milkbowl/vault2/helper/context/Context.java new file mode 100644 index 0000000..6fd183c --- /dev/null +++ b/src/main/java/net/milkbowl/vault2/helper/context/Context.java @@ -0,0 +1,155 @@ +package net.milkbowl.vault2.helper.context; +/* + 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 . + */ + +import org.jetbrains.annotations.Nullable; + +import java.util.Map; +import java.util.Optional; +import java.util.concurrent.ConcurrentHashMap; + +/** + * Represents an operational context that can optionally be associated with a specific world. + * The context determines the scope in which certain operations or checks, such as permissions, are applied. + * + * A global context is represented by the {@code GLOBAL} constant, which is not tied to any specific world. + * + * This class provides methods for retrieving the name of the world associated with the context, + * if any, and is used to manage scoped operations. + * @author creatorfromhell + * @since 2.18 + */ +public class Context { + + private final Map contextValues = new ConcurrentHashMap<>(); + + public static final Context GLOBAL = new Context(); + + private LookupMode lookupMode = LookupMode.GLOBAL_FALLBACK; + + public Context() { + } + + /** + * Constructs a new Context object and associates it with the specified world. + * The world is stored as part of the context's metadata under the {@code WORLD} key. + * + * @param world the name of the world to associate with this context + */ + public Context(final String world) { + contextValues.put(ContextKeys.WORLD, world); + } + + /** + * Constructs a new {@code Context} object with the specified world and lookup mode. + * The provided world is stored as part of the context's metadata under the {@code ContextKeys.WORLD} key. + * Additionally, the lookup mode determines how values are resolved within this context. + * + * @param world the name of the world to associate with this context + * @param lookupMode the mode of lookup operation to determine how values are resolved + */ + public Context(final String world, final LookupMode lookupMode) { + contextValues.put(ContextKeys.WORLD, world); + this.lookupMode = lookupMode; + } + + /** + * Constructs a new Context object with the specified context values. + * The provided context values map allows for associating additional metadata with the context. + * If the input map is null, the context will be initialized with no values. + * + * @param contextValues a map of key-value pairs representing the context's metadata, + * or null to create an empty context + */ + public Context(@Nullable final Map contextValues) { + if(contextValues != null) { + this.contextValues.putAll(contextValues); + } + } + + /** + * Constructs a new Context object with the specified context values and lookup mode. + * The provided context values map allows for associating additional metadata with the context. + * If the input map is null, the context will be initialized with no values. + * + * @param contextValues a map of key-value pairs representing the context's metadata, + * or null to create an empty context + * @param lookupMode the mode of lookup operation to determine how values are resolved + */ + public Context(@Nullable final Map contextValues, final LookupMode lookupMode) { + if(contextValues != null) { + this.contextValues.putAll(contextValues); + } + this.lookupMode = lookupMode; + } + + public LookupMode lookupMode() { + + return lookupMode; + } + + public void lookupMode(final LookupMode lookupMode) { + + this.lookupMode = lookupMode; + } + + public Optional world() { + return Optional.ofNullable(contextValues.get(ContextKeys.WORLD)); + } + + @Nullable + public String worldOrNull() { + return contextValues.get(ContextKeys.WORLD); + } + + public Optional value(final String key) { + return Optional.ofNullable(contextValues.get(key)); + } + + @Nullable + public String valueOrNull(final String key) { + return contextValues.get(key); + } + + public Map asMap() { + return contextValues; + } + + /** + * Creates a new {@code Context} object associated with the specified world. + * The provided {@code world} is stored as part of the context's metadata. + * + * @param world the name of the world to associate with the context + * @return a new {@code Context} instance associated with the specified world + */ + public static Context fromWorld(final String world) { + return new Context(world, LookupMode.GLOBAL_FALLBACK); + } + + /** + * Creates a new {@code Context} object associated with a specific world and lookup mode. + * The provided {@code world} is stored within the context's metadata using a predefined key, + * and the specified {@code lookupMode} determines how values are resolved within the context. + * + * @param world the name of the world to associate with the context + * @param lookupMode the mode of lookup operation to determine how values are resolved + * @return a new {@code Context} instance with the specified world and lookup mode + */ + public static Context fromWorld(final String world, final LookupMode lookupMode) { + return new Context(world, lookupMode); + } +} \ No newline at end of file diff --git a/src/main/java/net/milkbowl/vault2/helper/context/ContextKeys.java b/src/main/java/net/milkbowl/vault2/helper/context/ContextKeys.java new file mode 100644 index 0000000..2eace64 --- /dev/null +++ b/src/main/java/net/milkbowl/vault2/helper/context/ContextKeys.java @@ -0,0 +1,36 @@ +package net.milkbowl.vault2.helper.context; +/* + 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 . + */ + +/** + * Provides predefined keys used for defining or interacting with various contexts. + * + * This class serves as a centralized repository for context key constants. These keys are + * utilized within the context management system to identify specific metadata, such as the + * associated world for a given context. + * + * For example, the {@code WORLD} key is used to associate a context with a specific world. + * + * This class is designed for use in cases where constants are needed to standardize the + * management and interaction of context metadata. + * @author creatorfromhell + * @since 2.18 + */ +public class ContextKeys { + + public static final String WORLD = "world"; +} \ No newline at end of file diff --git a/src/main/java/net/milkbowl/vault2/helper/context/LookupMode.java b/src/main/java/net/milkbowl/vault2/helper/context/LookupMode.java new file mode 100644 index 0000000..806d3ad --- /dev/null +++ b/src/main/java/net/milkbowl/vault2/helper/context/LookupMode.java @@ -0,0 +1,33 @@ +package net.milkbowl.vault2.helper.context; +/* + 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 . + */ + +/** + * Defines the modes used for resolving or retrieving values within a given context. + * + * The lookup mode determines how values are queried or resolved: + * - {@code EXACT}: The lookup is restricted to the specific context provided, without considering any fallback options. + * - {@code GLOBAL_FALLBACK}: If the lookup in the specific context fails, a fallback resolution is attempted on a global context. + * + * @author creatorfromhell + * @since 2.18 + */ +public enum LookupMode { + + EXACT, + GLOBAL_FALLBACK +} \ No newline at end of file diff --git a/src/main/java/net/milkbowl/vault2/helper/subject/Subject.java b/src/main/java/net/milkbowl/vault2/helper/subject/Subject.java new file mode 100644 index 0000000..4c0e584 --- /dev/null +++ b/src/main/java/net/milkbowl/vault2/helper/subject/Subject.java @@ -0,0 +1,111 @@ +package net.milkbowl.vault2.helper.subject; +/* + 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 . + */ + +import org.bukkit.OfflinePlayer; + +import java.util.UUID; + +/** + * Represents a subject with a unique identifier, a name, and a flag indicating + * whether the subject is a player. + * + * This class provides methods to retrieve the subject's identifier and name, + * with additional metadata annotations to indicate nullability. + * + * @author creatorfromhell + * @since 2.18 + */ +public class Subject { + + private final String identifier; + private final String displayIdentifier; + private final SubjectType type; + + /** + * Constructs a new {@code Subject} instance with the specified identifier, display identifier, and type. + * If this is a player, the identifier is the stringified UUID of the player, and the display identifier is the player's username. + * If this is a group, the identifier is the group name or stringified UUID of the group if applicable, + * and the display identifier is the same as the identifier or name if the identifier is UUID. + * + * @param identifier the unique identifier for the subject + * @param displayIdentifier the display name associated with the subject + * @param type the type of the subject, indicating whether it is a player or group + */ + private Subject(final String identifier, final String displayIdentifier, final SubjectType type) { + this.identifier = identifier; + this.displayIdentifier = displayIdentifier; + this.type = type; + } + + public String identifier() { + return identifier; + } + + public UUID asUUID() { + return UUID.fromString(identifier); + } + + public String displayIdentifier() { + return displayIdentifier; + } + + public SubjectType type() { + return type; + } + + /** + * Creates a {@code Subject} instance representing a player using the given unique identifier and username. + * + * This method generates a {@code Subject} with the specified UUID as the unique identifier + * and the provided username as the display identifier. The {@code SubjectType} for this + * subject is set to {@code PLAYER}. + * + * @param uuid the unique identifier (UUID) of the player + * @param username the username associated with the player + * @return a {@code Subject} instance representing the specified player + */ + public static Subject player(final UUID uuid, final String username) { + return new Subject(uuid.toString(), username, SubjectType.PLAYER); + } + + /** + * Creates a {@code Subject} instance representing a group using the given group name. + * + * This method generates a {@code Subject} with the specified group name as both + * the unique identifier and display identifier, and sets the subject type to {@code GROUP}. + * + * @param groupName the name of the group to be used as the identifier and display identifier + * @return a {@code Subject} instance representing the specified group + */ + public static Subject group(final String groupName) { + return new Subject(groupName, groupName, SubjectType.GROUP); + } + + /** + * Creates a {@code Subject} instance representing a player using the provided {@link OfflinePlayer}. + * + * This method generates a {@code Subject} by extracting the player's unique identifier (UUID) + * and name from the given {@link OfflinePlayer} instance. + * + * @param player the {@link OfflinePlayer} instance containing the player's details + * @return a {@code Subject} instance representing the specified player + */ + public static Subject fromPlayer(final OfflinePlayer player) { + return player(player.getUniqueId(), player.getName()); + } +} \ No newline at end of file diff --git a/src/main/java/net/milkbowl/vault2/helper/subject/SubjectType.java b/src/main/java/net/milkbowl/vault2/helper/subject/SubjectType.java new file mode 100644 index 0000000..2a1c029 --- /dev/null +++ b/src/main/java/net/milkbowl/vault2/helper/subject/SubjectType.java @@ -0,0 +1,32 @@ +package net.milkbowl.vault2.helper.subject; +/* + 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 . + */ + +/** + * Represents the type of a subject, which can either be a player or a group. + * + * This enumeration helps differentiate between individual player subjects + * and group subjects in the context of the application. + * + * @author creatorfromhell + * @since 2.18 + */ +public enum SubjectType { + + PLAYER, + GROUP +} \ No newline at end of file diff --git a/src/main/java/net/milkbowl/vault2/permission/PermissionUnlocked.java b/src/main/java/net/milkbowl/vault2/permission/PermissionUnlocked.java index 36bfca8..3dda94d 100644 --- a/src/main/java/net/milkbowl/vault2/permission/PermissionUnlocked.java +++ b/src/main/java/net/milkbowl/vault2/permission/PermissionUnlocked.java @@ -16,15 +16,23 @@ along with Vault. If not, see . */ -import net.milkbowl.vault2.helper.Context; -import net.milkbowl.vault2.helper.Subject; +import net.milkbowl.vault2.helper.context.Context; +import net.milkbowl.vault2.helper.subject.Subject; import net.milkbowl.vault2.helper.TriState; import org.jetbrains.annotations.NotNull; import java.util.concurrent.CompletableFuture; /** - * PermissionsUnlocked + * Represents a permission provider to manage permissions, groups, and related operations + * within specific contexts and for specific subjects. + * + * This class offers methods to query, set, and retrieve permission states, either synchronously + * or asynchronously, including support for transient permissions and group-related operations. + * + * All operations assume that neither the context, subject, nor permission identifier are null. + * Operations may return default states (such as UNDEFINED) or empty values depending on + * context, group definitions, and permission configurations. * * @author creatorfromhell * @since 2.18 @@ -64,6 +72,31 @@ public interface PermissionUnlocked { */ boolean hasSuperPermsSupport(); + /** + * Copies permissions from one subject to another. + * + * @param context the operational context in which the permissions are being copied; must not be null + * @param from the source subject from which permissions are copied; must not be null + * @param to the target subject to which permissions are copied; must not be null + * @param includeTransient if true, includes transient permissions in the copy; otherwise, only durable permissions are copied + * @return true if the permissions were successfully copied, false otherwise + * @since 2.18 + */ + boolean copyPermissions(@NotNull Context context, @NotNull Subject from, @NotNull Subject to, boolean includeTransient); + + /** + * Asynchronously copies permissions from one subject to another. + * + * @param context the context in which the operation is performed; cannot be null + * @param from the source subject from which permissions will be copied; cannot be null + * @param to the target subject to which permissions will be copied; cannot be null + * @param includeTransient a flag indicating whether transient permissions should also be copied + * @return a CompletableFuture that resolves to true if the permissions were successfully copied, + * or false if the operation failed + * @since 2.18 + */ + CompletableFuture copyPermissionsAsync(@NotNull Context context, @NotNull Subject from, @NotNull Subject to, boolean includeTransient); + /** * Retrieves the permission state for a given context, subject, and permission identifier. * @@ -204,6 +237,28 @@ CompletableFuture setTransientPermissionAsync(@NotNull Context context, @NotNull CompletableFuture getGroupsAsync(@NotNull Context context, @NotNull Subject subject); + /** + * Copies all groups from the source subject to the target subject. + * + * @param context the context in which the operation is performed, must not be null + * @param from the source subject from which the groups will be copied, must not be null + * @param to the target subject to which the groups will be copied, must not be null + * @return true if the groups were successfully copied, false otherwise + * @since 2.18 + */ + boolean copyGroups(@NotNull Context context, @NotNull Subject from, @NotNull Subject to); + + /** + * Asynchronously copies groups from one subject to another subject within the given context. + * + * @param context the context in which the groups will be copied; must not be null + * @param from the source subject from which groups will be copied; must not be null + * @param to the target subject to which groups will be copied; must not be null + * @return a {@code CompletableFuture} that completes with {@code true} if the groups are copied successfully, or {@code false} otherwise + * @since 2.18 + */ + CompletableFuture copyGroupsAsync(@NotNull Context context, @NotNull Subject from, @NotNull Subject to); + /** * Determines whether the specified subject is in a group within the given context. * From 3fad1dcc2e129e1bffba177dd634ed183f1db379 Mon Sep 17 00:00:00 2001 From: "Daniel V." Date: Fri, 16 Jan 2026 11:24:28 -0500 Subject: [PATCH 95/95] Extract `fromPlayer` method to new `BukkitHelper` class and remove from `Subject`. --- .../vault2/helper/subject/Subject.java | 15 ------ .../vault2/minecraft/BukkitHelper.java | 50 +++++++++++++++++++ 2 files changed, 50 insertions(+), 15 deletions(-) create mode 100644 src/main/java/net/milkbowl/vault2/minecraft/BukkitHelper.java diff --git a/src/main/java/net/milkbowl/vault2/helper/subject/Subject.java b/src/main/java/net/milkbowl/vault2/helper/subject/Subject.java index 4c0e584..312e5d2 100644 --- a/src/main/java/net/milkbowl/vault2/helper/subject/Subject.java +++ b/src/main/java/net/milkbowl/vault2/helper/subject/Subject.java @@ -16,8 +16,6 @@ along with Vault. If not, see . */ -import org.bukkit.OfflinePlayer; - import java.util.UUID; /** @@ -95,17 +93,4 @@ public static Subject player(final UUID uuid, final String username) { public static Subject group(final String groupName) { return new Subject(groupName, groupName, SubjectType.GROUP); } - - /** - * Creates a {@code Subject} instance representing a player using the provided {@link OfflinePlayer}. - * - * This method generates a {@code Subject} by extracting the player's unique identifier (UUID) - * and name from the given {@link OfflinePlayer} instance. - * - * @param player the {@link OfflinePlayer} instance containing the player's details - * @return a {@code Subject} instance representing the specified player - */ - public static Subject fromPlayer(final OfflinePlayer player) { - return player(player.getUniqueId(), player.getName()); - } } \ No newline at end of file diff --git a/src/main/java/net/milkbowl/vault2/minecraft/BukkitHelper.java b/src/main/java/net/milkbowl/vault2/minecraft/BukkitHelper.java new file mode 100644 index 0000000..5b6bbb4 --- /dev/null +++ b/src/main/java/net/milkbowl/vault2/minecraft/BukkitHelper.java @@ -0,0 +1,50 @@ +package net.milkbowl.vault2.minecraft; +/* + 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 . + */ + +import net.milkbowl.vault2.helper.subject.Subject; +import org.bukkit.OfflinePlayer; + +import static net.milkbowl.vault2.helper.subject.Subject.player; + +/** + * A utility class designed to assist with common operations and functionalities + * in the Bukkit or Spigot API environment. This class contains static methods + * and utilities that simplify plugin development tasks. + * + * This helper class is intended for use in Minecraft server plugins and + * provides abstractions or shortcuts for typical operations involving the + * Bukkit API. + * + * @author creatorfromhell + * @since 2.18 + */ +public class BukkitHelper { + + /** + * Creates a {@code Subject} instance representing a player using the provided {@link OfflinePlayer}. + * + * This method generates a {@code Subject} by extracting the player's unique identifier (UUID) + * and name from the given {@link OfflinePlayer} instance. + * + * @param player the {@link OfflinePlayer} instance containing the player's details + * @return a {@code Subject} instance representing the specified player + */ + public static Subject fromPlayer(final OfflinePlayer player) { + return player(player.getUniqueId(), player.getName()); + } +} \ No newline at end of file