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 Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Currency
defaultCurrency()
Retrieves the defaultCurrency
used by theEconomyService
.AccountDeletionResultType
deleteAccount(String identifier)
Deletes the account with the specified identifier.AccountDeletionResultType
deleteAccount(UUID uuid)
Deletes the account for the user with the specifiedUUID
.Optional<Account>
findOrCreateAccount(String identifier)
Gets theVirtualAccount
with the specified identifier.Optional<UniqueAccount>
findOrCreateAccount(UUID uuid)
Gets theUniqueAccount
for the user with the specifiedUUID
.boolean
hasAccount(String identifier)
Returns whether anAccount
with the specified identifier exists.boolean
hasAccount(UUID uuid)
Returns whether aUniqueAccount
exists with the specifiedUUID
.Stream<UniqueAccount>
streamUniqueAccounts()
Gets aStream
of all availableUniqueAccount
s.Stream<VirtualAccount>
streamVirtualAccounts()
Gets aStream
of all availableVirtualAccount
s.Collection<UniqueAccount>
uniqueAccounts()
Gets aCollection
of all availableUniqueAccount
s.Collection<VirtualAccount>
virtualAccounts()
Gets aCollection
of all availableVirtualAccount
s.
-
-
-
Method Detail
-
defaultCurrency
Currency defaultCurrency()
Retrieves the defaultCurrency
used by theEconomyService
.
-
hasAccount
boolean hasAccount(UUID uuid)
Returns whether aUniqueAccount
exists with the specifiedUUID
.- Parameters:
uuid
- TheUUID
of the account to check for- Returns:
- Whether a
UniqueAccount
exists with the specifiedUUID
-
hasAccount
boolean hasAccount(String identifier)
Returns whether anAccount
with the specified identifier exists.Depending on the implementation, the
Account
may be aUniqueAccount
or aVirtualAccount
.- 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 theUniqueAccount
for the user with the specifiedUUID
.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
- TheUUID
of the account to get.- Returns:
- The
UniqueAccount
, if available.
-
findOrCreateAccount
Optional<Account> findOrCreateAccount(String identifier)
Gets theVirtualAccount
with the specified identifier.Depending on the implementation, the
Account
may be aUniqueAccount
or aVirtualAccount
.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 aStream
of all availableUniqueAccount
s.- Returns:
- A stream of all
UniqueAccount
s.
-
uniqueAccounts
Collection<UniqueAccount> uniqueAccounts()
Gets aCollection
of all availableUniqueAccount
s.- Returns:
- A Collection of all
UniqueAccount
s.
-
streamVirtualAccounts
Stream<VirtualAccount> streamVirtualAccounts()
Gets aStream
of all availableVirtualAccount
s.- Returns:
- A stream of all
VirtualAccount
s.
-
virtualAccounts
Collection<VirtualAccount> virtualAccounts()
Gets aCollection
of all availableVirtualAccount
s.- Returns:
- A Collection of all
VirtualAccount
s.
-
deleteAccount
AccountDeletionResultType deleteAccount(UUID uuid)
Deletes the account for the user with the specifiedUUID
.Deletion might fail if the provided
UUID
does not correspond to an actual player, or for some other implementation-defined reason.- Parameters:
uuid
- TheUUID
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.
-
-