Interface EconomyService


public interface EconomyService
Represents a service for managing a server economy.

Unlike other services provided by the API, the economy service does **not** have an implementation registered by default. Since Vanilla has no concept of economy, the economy service implementation must always be provided by a plugin. This service exists to provide a common API which can be used by implementors and consumers.

  • Method Details

    • defaultCurrency

      Currency defaultCurrency()
      Retrieves the default Currency used by the EconomyService.
      Returns:
      Currency default for the EconomyService
      See Also:
    • hasAccount

      boolean hasAccount(UUID uuid)
      Returns whether a UniqueAccount exists with the specified UUID.
      Parameters:
      uuid - The UUID of the account to check for
      Returns:
      Whether a UniqueAccount exists with the specified UUID
    • hasAccount

      boolean hasAccount(String identifier)
      Returns whether an Account with the specified identifier exists.

      Depending on the implementation, the Account may be a UniqueAccount or a VirtualAccount.

      Parameters:
      identifier - The identifier of the account to check for
      Returns:
      Whether an Account with the specified identifier exists
    • findOrCreateAccount

      Optional<UniqueAccount> findOrCreateAccount(UUID uuid)
      Gets the UniqueAccount for the user with the specified UUID.

      If an account does not already exist with the specified UUID, it will be created.

      Creation might fail if the provided UUID does not correspond to an actual player, or for an implementation-defined reason.

      Parameters:
      uuid - The UUID of the account to get.
      Returns:
      The UniqueAccount, if available.
    • findOrCreateAccount

      Optional<Account> findOrCreateAccount(String identifier)
      Gets the VirtualAccount with the specified identifier.

      Depending on the implementation, the Account may be a UniqueAccount or a VirtualAccount.

      If an account does not already exist with the specified identifier, it will be created.

      Creation may fail for an implementation-defined reason.

      Parameters:
      identifier - The identifier of the account to get.
      Returns:
      The Account, if available.
    • streamUniqueAccounts

      Stream<UniqueAccount> streamUniqueAccounts()
      Gets a Stream of all available UniqueAccounts.
      Returns:
      A stream of all UniqueAccounts.
    • uniqueAccounts

      Collection<UniqueAccount> uniqueAccounts()
      Gets a Collection of all available UniqueAccounts.
      Returns:
      A Collection of all UniqueAccounts.
    • streamVirtualAccounts

      Stream<VirtualAccount> streamVirtualAccounts()
      Gets a Stream of all available VirtualAccounts.
      Returns:
      A stream of all VirtualAccounts.
    • virtualAccounts

      Collection<VirtualAccount> virtualAccounts()
      Gets a Collection of all available VirtualAccounts.
      Returns:
      A Collection of all VirtualAccounts.
    • deleteAccount

      AccountDeletionResultType deleteAccount(UUID uuid)
      Deletes the account for the user with the specified UUID.

      Deletion might fail if the provided UUID does not correspond to an actual player, or for some other implementation-defined reason.

      Parameters:
      uuid - The UUID of the account to delete.
      Returns:
      The result of the deletion.
    • deleteAccount

      AccountDeletionResultType deleteAccount(String identifier)
      Deletes the account with the specified identifier.

      If an account exists with the specified identifier, it will be deleted.

      Deletion may fail for an implementation-defined reason.

      Parameters:
      identifier - The identifier of the account to delete.
      Returns:
      The result of the deletion.