Splitted IdentityEconomy isLegacy method into supportsAllRecordsOperation and supportsAllOnlineOperation

Improved IdentityEconomy and MultiEconomy documentation
This commit is contained in:
lbenav8095 2023-03-29 17:43:16 -06:00
parent dfd74cea31
commit 5dc0217eb7
4 changed files with 26 additions and 12 deletions

View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>net.milkbowl.vault</groupId>
<artifactId>vaultapi</artifactId>
<version>2.4-SNAPSHOT</version>
<version>2.0-SNAPSHOT</version>
<name>VaultAPI</name>
<description>Vault is a Permissions &amp; Economy API to allow plugins to more easily hook into these systems without needing to hook each individual system themselves.

View File

@ -25,9 +25,10 @@ import java.util.UUID;
/**
* Adds UUID support to the Economy interface.
* In case of {@link #isLegacy()} returning false, methods such as:
* In case of {@link #supportsAllRecordsOperation()} or {@link #supportsAllOnlineOperation()}
* returning true, methods such as
* {@link #getAllRecords()} and {@link #getAllOnline()}
* should be expected to work.
* should not be expected to work.
* <p>
* In order to register/provide it, you should use {@link IdentityEconomyWrapper#registerProviders()}
*/
@ -35,15 +36,22 @@ public interface IdentityEconomy extends Economy{
/**
* Used to determine if IdentityEconomy was built through
* the EconomyWrapper as a LegacyEconomy.
* If true, methods such as {@link #getAllRecords()} and {@link #getAllOnline()} (UUID)}
* will not be work.
* If true, method {@link #getAllRecords()} will not be work.
* This was made in order to support plugins which use older versions of VaultAPI/Vault.
* You can also use it / override it to disable previous mentioned methods!
* @return if this is a legacy economy
* @return true if operation is supported
*/
public default boolean isLegacy(){
return false;
}
public boolean supportsAllRecordsOperation();
/**
* Used to determine if IdentityEconomy was built through
* the EconomyWrapper as a LegacyEconomy.
* If true, the method {@link #getAllOnline()} (UUID)} will not be work.
* This was made in order to support plugins which use older versions of VaultAPI/Vault.
* You can also use it / override it to disable previous mentioned methods!
* @return true if operation is supported
*/
public boolean supportsAllOnlineOperation();
/*
* Account-related methods follow.

View File

@ -14,8 +14,13 @@ public class LegacyEconomy implements IdentityEconomy {
}
@Override
public boolean isLegacy() {
return true;
public boolean supportsAllRecordsOperation() {
return false;
}
@Override
public boolean supportsAllOnlineOperation() {
return false;
}
@Override

View File

@ -13,7 +13,8 @@ import java.util.Collection;
* In order to register/provide it, you should use {@link MultiEconomyWrapper#registerProviders()}
* Inside this interface, we make use of the term "implementation" to refer to an actual currency.
* You should expect that these currencies/implementations might
* return true for {@link IdentityEconomy#isLegacy()} in case plugin's author preference!
* return false for both {@link IdentityEconomy#supportsAllRecordsOperation()} and
* {@link IdentityEconomy#supportsAllOnlineOperation()} in case of plugin's author preference!
*/
public interface MultiEconomy {