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 Detail

      • hasAccount

        boolean hasAccount​(java.util.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​(java.lang.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

        java.util.Optional<UniqueAccount> findOrCreateAccount​(java.util.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

        java.util.Optional<Account> findOrCreateAccount​(java.lang.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.
      • deleteAccount

        AccountDeletionResultType deleteAccount​(java.util.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​(java.lang.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.