Skip to content

Commit dbbef5e

Browse files
Merge pull request #29 from weaves7/master
Add canDeposit and canWithdraw methods to Economy interface
2 parents 3e3f529 + 39a8c60 commit dbbef5e

4 files changed

Lines changed: 183 additions & 2 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/target
22
/dependency-reduced-pom.xml
3+
CLAUDE.md
34
/.classpath
45
/.project
56
/.settings

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ plugins {
44
}
55

66
group = "net.milkbowl.vault"
7-
version = "2.18"
7+
version = "2.19"
88
description = "VaultUnlockedAPI"
99

1010
repositories {

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>net.milkbowl.vault</groupId>
55
<artifactId>VaultUnlockedAPI</artifactId>
6-
<version>2.16</version>
6+
<version>2.19</version>
77

88

99
<name>VaultUnlockedAPI</name>

src/main/java/net/milkbowl/vault2/economy/Economy.java

Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -768,6 +768,186 @@ default EconomyResponse set(@NotNull final String pluginName, @NotNull final UUI
768768
EconomyResponse withdraw(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final String worldName, @NotNull final String currency, @NotNull final BigDecimal amount);
769769

770770
/**
771+
* Checks if an account associated with a UUID can receive a deposit of the specified amount.
772+
* Checks performed are up to the implementation, but could include balance limits, account
773+
* status, inventory space for item-based currencies, or other provider-specific validations.
774+
* <p>
775+
* Note: Negative amounts should not be used.
776+
* <br>
777+
* Note: {@code pluginName} should be used for logging/diagnostics only and MUST NOT affect
778+
* business logic.
779+
* </p>
780+
* @param pluginName The name of the plugin that is calling the method.
781+
* @param accountID the UUID associated with the account to check.
782+
* @param amount Amount to check.
783+
*
784+
* @return {@link EconomyResponse} which includes the Economy plugin's {@link ResponseType}
785+
* indicating whether the account can receive the deposit. On success, amount is the checked
786+
* amount and balance is the current balance.
787+
*
788+
* @since 2.19
789+
*/
790+
@NotNull
791+
default EconomyResponse canDeposit(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final BigDecimal amount) {
792+
793+
return new EconomyResponse(BigDecimal.ZERO, BigDecimal.ZERO, ResponseType.NOT_IMPLEMENTED, "canDeposit is not implemented by this economy provider.");
794+
}
795+
796+
/**
797+
* Checks if an account associated with a UUID can receive a deposit of the specified amount
798+
* in a given world.
799+
* Checks performed are up to the implementation, but could include balance limits, account
800+
* status, inventory space for item-based currencies, or other provider-specific validations.
801+
* <p>
802+
* Note: Negative amounts should not be used.
803+
* <br>
804+
* Note: {@code pluginName} should be used for logging/diagnostics only and MUST NOT affect
805+
* business logic.
806+
* <br>
807+
* If the provider does not support multiple worlds, the provider's default world will be used.
808+
* </p>
809+
* @param pluginName The name of the plugin that is calling the method.
810+
* @param accountID the UUID associated with the account to check.
811+
* @param worldName the name of the world to check in.
812+
* @param amount Amount to check.
813+
*
814+
* @return {@link EconomyResponse} which includes the Economy plugin's {@link ResponseType}
815+
* indicating whether the account can receive the deposit. On success, amount is the checked
816+
* amount and balance is the current balance.
817+
*
818+
* @since 2.19
819+
*/
820+
@NotNull
821+
default EconomyResponse canDeposit(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final String worldName, @NotNull final BigDecimal amount) {
822+
823+
return new EconomyResponse(BigDecimal.ZERO, BigDecimal.ZERO, ResponseType.NOT_IMPLEMENTED, "canDeposit is not implemented by this economy provider.");
824+
}
825+
826+
/**
827+
* Checks if an account associated with a UUID can receive a deposit of the specified amount
828+
* in a given world and currency.
829+
* Checks performed are up to the implementation, but could include balance limits, account
830+
* status, inventory space for item-based currencies, or other provider-specific validations.
831+
* <p>
832+
* Note: Negative amounts should not be used.
833+
* <br>
834+
* Note: {@code pluginName} should be used for logging/diagnostics only and MUST NOT affect
835+
* business logic.
836+
* <br>
837+
* If the provider does not support multiple worlds, the provider's default world will be used.
838+
* <br>
839+
* If the provider does not support multi-currency, the provider's default currency will be
840+
* used.
841+
* </p>
842+
* @param pluginName The name of the plugin that is calling the method.
843+
* @param accountID the UUID associated with the account to check.
844+
* @param worldName the name of the world to check in.
845+
* @param currency the currency to use.
846+
* @param amount Amount to check.
847+
*
848+
* @return {@link EconomyResponse} which includes the Economy plugin's {@link ResponseType}
849+
* indicating whether the account can receive the deposit. On success, amount is the checked
850+
* amount and balance is the current balance.
851+
*
852+
* @since 2.19
853+
*/
854+
@NotNull
855+
default EconomyResponse canDeposit(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final String worldName, @NotNull final String currency, @NotNull final BigDecimal amount) {
856+
857+
return new EconomyResponse(BigDecimal.ZERO, BigDecimal.ZERO, ResponseType.NOT_IMPLEMENTED, "canDeposit is not implemented by this economy provider.");
858+
}
859+
860+
/**
861+
* Checks if an account associated with a UUID can perform a withdrawal of the specified amount.
862+
* Checks performed are up to the implementation, but could include account status, withdrawal
863+
* limits, cooldowns, or other provider-specific validations beyond simple balance checks.
864+
* <p>
865+
* Note: Negative amounts should not be used.
866+
* <br>
867+
* Note: {@code pluginName} should be used for logging/diagnostics only and MUST NOT affect
868+
* business logic.
869+
* </p>
870+
* @param pluginName The name of the plugin that is calling the method.
871+
* @param accountID the UUID associated with the account to check.
872+
* @param amount Amount to check.
873+
*
874+
* @return {@link EconomyResponse} which includes the Economy plugin's {@link ResponseType}
875+
* indicating whether the account can perform the withdrawal. On success, amount is the checked
876+
* amount and balance is the current balance.
877+
*
878+
* @since 2.19
879+
*/
880+
@NotNull
881+
default EconomyResponse canWithdraw(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final BigDecimal amount) {
882+
883+
return new EconomyResponse(BigDecimal.ZERO, BigDecimal.ZERO, ResponseType.NOT_IMPLEMENTED, "canWithdraw is not implemented by this economy provider.");
884+
}
885+
886+
/**
887+
* Checks if an account associated with a UUID can perform a withdrawal of the specified amount
888+
* in a given world.
889+
* Checks performed are up to the implementation, but could include account status, withdrawal
890+
* limits, cooldowns, or other provider-specific validations beyond simple balance checks.
891+
* <p>
892+
* Note: Negative amounts should not be used.
893+
* <br>
894+
* Note: {@code pluginName} should be used for logging/diagnostics only and MUST NOT affect
895+
* business logic.
896+
* <br>
897+
* If the provider does not support multiple worlds, the provider's default world will be used.
898+
* </p>
899+
* @param pluginName The name of the plugin that is calling the method.
900+
* @param accountID the UUID associated with the account to check.
901+
* @param worldName the name of the world to check in.
902+
* @param amount Amount to check.
903+
*
904+
* @return {@link EconomyResponse} which includes the Economy plugin's {@link ResponseType}
905+
* indicating whether the account can perform the withdrawal. On success, amount is the checked
906+
* amount and balance is the current balance.
907+
*
908+
* @since 2.19
909+
*/
910+
@NotNull
911+
default EconomyResponse canWithdraw(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final String worldName, @NotNull final BigDecimal amount) {
912+
913+
return new EconomyResponse(BigDecimal.ZERO, BigDecimal.ZERO, ResponseType.NOT_IMPLEMENTED, "canWithdraw is not implemented by this economy provider.");
914+
}
915+
916+
/**
917+
* Checks if an account associated with a UUID can perform a withdrawal of the specified amount
918+
* in a given world and currency.
919+
* Checks performed are up to the implementation, but could include account status, withdrawal
920+
* limits, cooldowns, or other provider-specific validations beyond simple balance checks.
921+
* <p>
922+
* Note: Negative amounts should not be used.
923+
* <br>
924+
* Note: {@code pluginName} should be used for logging/diagnostics only and MUST NOT affect
925+
* business logic.
926+
* <br>
927+
* If the provider does not support multiple worlds, the provider's default world will be used.
928+
* <br>
929+
* If the provider does not support multi-currency, the provider's default currency will be
930+
* used.
931+
* </p>
932+
* @param pluginName The name of the plugin that is calling the method.
933+
* @param accountID the UUID associated with the account to check.
934+
* @param worldName the name of the world to check in.
935+
* @param currency the currency to use.
936+
* @param amount Amount to check.
937+
*
938+
* @return {@link EconomyResponse} which includes the Economy plugin's {@link ResponseType}
939+
* indicating whether the account can perform the withdrawal. On success, amount is the checked
940+
* amount and balance is the current balance.
941+
*
942+
* @since 2.19
943+
*/
944+
@NotNull
945+
default EconomyResponse canWithdraw(@NotNull final String pluginName, @NotNull final UUID accountID, @NotNull final String worldName, @NotNull final String currency, @NotNull final BigDecimal amount) {
946+
947+
return new EconomyResponse(BigDecimal.ZERO, BigDecimal.ZERO, ResponseType.NOT_IMPLEMENTED, "canWithdraw is not implemented by this economy provider.");
948+
}
949+
950+
/**
771951
* Deposit an amount to an account associated with the given UUID
772952
* <p>
773953
* Note: Negative amounts should not be used. Use withdraw methods instead.

0 commit comments

Comments
 (0)