Class EconomySystemAPI
java.lang.Object
enterprises.iwakura.economysystem.api.EconomySystemAPI
API class for accessing Economy System's features.
-
Constructor Summary
ConstructorsConstructorDescriptionEconomySystemAPI(org.bukkit.plugin.Plugin plugin) Creates an instance of EconomySystemAPI with your plugin. -
Method Summary
Modifier and TypeMethodDescriptiongetAccount(UUID entityId, BankingAccountTypeEnum accountType) Gets the account for the given entity ID and account type.getAccounts(UUID entityId) Gets the accounts for the given entity ID.transfer(Long fromAccountNumber, Long toAccountNumber, BigDecimal amount, String detail) Transfers money between two accounts.transfer(UUID fromEntity, BankingAccountTypeEnum fromEntityAccountType, UUID toEntity, BankingAccountTypeEnum toEntityAccountType, BigDecimal amount, String detail) Transfers money between two entities.
-
Constructor Details
-
EconomySystemAPI
public EconomySystemAPI(org.bukkit.plugin.Plugin plugin) Creates an instance of EconomySystemAPI with your plugin.- Parameters:
plugin- The plugin instance that is using the API.
-
-
Method Details
-
transfer
public CompletableFuture<AccountingTransactionDTO> transfer(UUID fromEntity, BankingAccountTypeEnum fromEntityAccountType, UUID toEntity, BankingAccountTypeEnum toEntityAccountType, BigDecimal amount, String detail) Transfers money between two entities.- Parameters:
fromEntity- From entityfromEntityAccountType- From entity account typetoEntity- To entitytoEntityAccountType- To entity account typeamount- Amount to transferdetail- Transaction detail- Returns:
- A CompletableFuture that will be completed with the transaction DTO. If transactions fails due to non-existing accounts or invalid arguments (such as non-positive amount), the future will be completed exceptionally.
-
transfer
public CompletableFuture<AccountingTransactionDTO> transfer(Long fromAccountNumber, Long toAccountNumber, BigDecimal amount, String detail) Transfers money between two accounts.- Parameters:
fromAccountNumber- From account numbertoAccountNumber- To account numberamount- Amount to transferdetail- Transaction detail- Returns:
- A CompletableFuture that will be completed with the transaction DTO. If transactions fails due to non-existing accounts or invalid
-
getAccounts
Gets the accounts for the given entity ID.- Parameters:
entityId- Entity ID- Returns:
- A CompletableFuture that will be completed with the list of account DTOs for the given entity ID. If entity has no accounts, the list will be empty.
-
getAccount
public CompletableFuture<BankingAccountDTO> getAccount(UUID entityId, BankingAccountTypeEnum accountType) Gets the account for the given entity ID and account type.- Parameters:
entityId- Entity IDaccountType- Account type- Returns:
- A CompletableFuture that will be completed with the account DTO for the given entity ID and account type. If entity has no account of the given type, the future will be completed exceptionally.
-