Class EconomySystemAPI

java.lang.Object
enterprises.iwakura.economysystem.api.EconomySystemAPI

public class EconomySystemAPI extends Object
API class for accessing Economy System's features.
  • 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 entity
      fromEntityAccountType - From entity account type
      toEntity - To entity
      toEntityAccountType - To entity account type
      amount - Amount to transfer
      detail - 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 number
      toAccountNumber - To account number
      amount - Amount to transfer
      detail - Transaction detail
      Returns:
      A CompletableFuture that will be completed with the transaction DTO. If transactions fails due to non-existing accounts or invalid
    • getAccounts

      public CompletableFuture<List<BankingAccountDTO>> getAccounts(UUID entityId)
      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 ID
      accountType - 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.