public interface EconomyService extends ContextualService<Account>
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.
Modifier and Type | Method and Description |
---|---|
default AccountDeletionResultType |
deleteAccount(String identifier)
Deletes the account with the specified identifier.
|
default AccountDeletionResultType |
deleteAccount(UUID uuid)
Deletes the account for the user with the specified
UUID . |
Set<Currency> |
getCurrencies()
|
Currency |
getDefaultCurrency()
Retrieves the default
Currency used by the
EconomyService . |
Optional<Account> |
getOrCreateAccount(String identifier)
Gets the
VirtualAccount with the specified identifier. |
Optional<UniqueAccount> |
getOrCreateAccount(UUID uuid)
Gets the
UniqueAccount for the user with the specified
UUID . |
boolean |
hasAccount(String identifier)
Returns whether an
Account with the specified identifier exists. |
boolean |
hasAccount(UUID uuid)
Returns whether a
UniqueAccount exists with the specified
UUID . |
registerContextCalculator
Currency getDefaultCurrency()
Currency
used by the
EconomyService
.Set<Currency> getCurrencies()
Set
of supported Currency
objects that are
implemented by this EconomyService.
The economy service provider may only support one currency, in which
case getDefaultCurrency()
will be the only member of the set.
The set returned is a read-only a view of all currencies available in the EconomyService.
boolean hasAccount(UUID uuid)
UniqueAccount
exists with the specified
UUID
.uuid
- The UUID
of the account to check forUniqueAccount
exists with the specified
UUID
boolean hasAccount(String identifier)
Account
with the specified identifier exists.
Depending on the implementation, the Account
may be a
UniqueAccount
or a VirtualAccount
.
identifier
- The identifier of the account to check forAccount
with the specified identifier existsOptional<UniqueAccount> getOrCreateAccount(UUID uuid)
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.
uuid
- The UUID
of the account to get.UniqueAccount
, if available.Optional<Account> getOrCreateAccount(String identifier)
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.
identifier
- The identifier of the account to get.Account
, if available.default AccountDeletionResultType deleteAccount(UUID uuid)
UUID
.
Deletion might fail if the provided UUID
does not correspond
to an actual player, or for some other implementation-defined reason.
uuid
- The UUID
of the account to delete.default AccountDeletionResultType deleteAccount(String identifier)
If an account exists with the specified identifier, it will be deleted.
Deletion may fail for an implementation-defined reason.
identifier
- The identifier of the account to delete.