Interface Account
- All Superinterfaces:
- Contextual
- All Known Subinterfaces:
- UniqueAccount,- VirtualAccount
currencies.
 Accounts come in two varieties: user accounts
 and VirtualAccount virtual accounts.
 Unique accounts are bound to a UUID, usually of a particular
 User's GameProfile.
 Virtual accounts are identified by a String identifier, which may have any
 value. They are not tied to any Entity, player or otherwise. Virtual
 accounts may be used for purposes such as bank accounts, non-player
 Entity accounts, or other things.
- 
Method SummaryModifier and TypeMethodDescriptiondefault BigDecimalReturns aBigDecimalrepresentative of the balance stored within thisAccountfor theCurrencygiven, with the current active cause.Returns aBigDecimalrepresentative of the balance stored within thisAccountfor theCurrencygiven and the set ofContexts.Returns aBigDecimalrepresentative of the balance stored within thisAccountfor theCurrencygiven and the set ofContexts.default Map<Currency,BigDecimal> balances()defaultBalance(Currency currency) Gets the default balance of this account for the specifiedCurrency.default TransactionResultdeposit(Currency currency, BigDecimal amount) deposit(Currency currency, BigDecimal amount, Set<Context> contexts) deposit(Currency currency, BigDecimal amount, Cause cause) Gets the display name for this account.default booleanhasBalance(Currency currency) Returns whether this account has a set balance for the specifiedCurrency, with the current active cause.booleanhasBalance(Currency currency, Set<Context> contexts) booleanhasBalance(Currency currency, Cause cause) default TransactionResultresetBalance(Currency currency) Resets the balance for the specifiedCurrencyto its default value (defaultBalance(Currency)), using the current activeContexts.resetBalance(Currency currency, Set<Context> contexts) Resets the balance for the specifiedCurrencyto its default value (defaultBalance(Currency)), using the specifiedContexts.resetBalance(Currency currency, Cause cause) Resets the balance for the specifiedCurrencyto its default value (defaultBalance(Currency)), using context from the specifiedCause.default Map<Currency,TransactionResult> Resets the balances for allCurrencys used on this account to their default values (defaultBalance(Currency)), using the current activeContext.resetBalances(Set<Context> contexts) Resets the balances for allCurrencys used on this account to their default values (defaultBalance(Currency)), using the specifiedContexts.resetBalances(Cause cause) Resets the balances for allCurrencys used on this account to their default values (defaultBalance(Currency)), using the specifiedCauses.default TransactionResultsetBalance(Currency currency, BigDecimal amount) setBalance(Currency currency, BigDecimal amount, Set<Context> contexts) setBalance(Currency currency, BigDecimal amount, Cause cause) default TransferResulttransfer(Account to, Currency currency, BigDecimal amount) transfer(Account to, Currency currency, BigDecimal amount, Cause cause) default TransactionResultwithdraw(Currency currency, BigDecimal amount) withdraw(Currency currency, BigDecimal amount, Set<Context> contexts) withdraw(Currency currency, BigDecimal amount, Cause cause) Methods inherited from interface org.spongepowered.api.service.context.ContextualcontextCause, friendlyIdentifier, identifier
- 
Method Details- 
displayNameComponent displayName()Gets the display name for this account.This should be used by plugins to get a human-readable name for an account, regardless of the specific type ( UniqueAccountorVirtualAccount).Its contents are dependent on the provider of .EconomyService. For example, an economy plugin could allow players to configure the display name of their account- Returns:
- The display name for this account
 
- 
defaultBalanceGets the default balance of this account for the specifiedCurrency.The default balance is used when the balance is retrieved for the first time for a given Currencyon this account, or if no balance is available for theContexts used when retrieving a balance.- Parameters:
- currency- the currency to get the default balance for.
- Returns:
- The default balance for the specified Currency.
 
- 
hasBalanceReturns whether this account has a set balance for the specifiedCurrency, with the specifiedContexts.If this method returns false, thendefaultBalance(Currency)will be used when retrieving a balance for the specifiedCurrencywith the specifiedContexts.
- 
hasBalanceReturns whether this account has a set balance for the specifiedCurrency, with context from the specifiedCauses.If this method returns false, thendefaultBalance(Currency)will be used when retrieving a balance for the specifiedCurrencywith the specifiedContexts.
- 
hasBalanceReturns whether this account has a set balance for the specifiedCurrency, with the current active cause.If this method returns .false, thendefaultBalance(Currency)will be used when retrieving a balance for the specifidCurrencywith the current active cause
- 
balanceReturns aBigDecimalrepresentative of the balance stored within thisAccountfor theCurrencygiven and the set ofContexts.The default result when the account does not have a balance of the given Currencywill bedefaultBalance(Currency).The balance may be unavailable depending on the set of Contexts used.
- 
balanceReturns aBigDecimalrepresentative of the balance stored within thisAccountfor theCurrencygiven and the set ofContexts.The default result when the account does not have a balance of the given Currencywill bedefaultBalance(Currency).The balance may be unavailable depending on the set of Contexts used.
- 
balanceReturns aBigDecimalrepresentative of the balance stored within thisAccountfor theCurrencygiven, with the current active cause.The default result when the account does not have a balance of the given Currencywill bedefaultBalance(Currency).
- 
balancesReturns aMapof all currently set balances the account holds within the set ofContexts.Amounts may differ depending on the Contexts specified and the implementation. The set ofContexts may be empty.Currencyamounts which are 0 may or may not be included in the returned mapping.Changes to the returned Mapwill not be reflected in the underlyingAccount. SeesetBalance(Currency, BigDecimal, Cause)to set values.- Parameters:
- contexts- the set of- Contexts to use with the specified amounts
- Returns:
- A MapofCurrencytoBigDecimalamounts that this account holds
 
- 
balancesReturns aMapof all currently set balances the account holds within the set ofContexts.Amounts may differ depending on the Causespecified and the implementation. The set ofContexts may be empty.Currencyamounts which are 0 may or may not be included in the returned mapping.Changes to the returned Mapwill not be reflected in the underlyingAccount. SeesetBalance(Currency, BigDecimal, Cause)to set values.- Parameters:
- cause- the set of- Contexts to use with the specified amounts
- Returns:
- A MapofCurrencytoBigDecimalamounts that this account holds
 
- 
balancesReturns aMapof all currently set balances the account holds within the current activeContext.Amounts may differ depending on the Contexts specified and the implementation. The set ofContexts may be empty.Currencyamounts which are 0 may or may not be included in the returned mapping.Changes to the returned Mapwill not be reflected in the underlyingAccountand may result in runtime exceptions depending on implementation. SeesetBalance(Currency, BigDecimal, Cause)to set values.- Returns:
- A MapofCurrencytoBigDecimalamounts that this account holds
 
- 
setBalance
- 
setBalance
- 
setBalance
- 
resetBalancesResets the balances for allCurrencys used on this account to their default values (defaultBalance(Currency)), using the specifiedContexts.- Parameters:
- contexts- the- Contexts to use when resetting the balances.
- Returns:
- A map of CurrencytoTransactionResult. Each entry represents the result of resetting a particular currency.
 
- 
resetBalancesResets the balances for allCurrencys used on this account to their default values (defaultBalance(Currency)), using the specifiedCauses.- Parameters:
- cause- the cause to computer context to use when resetting the balances.
- Returns:
- A map of CurrencytoTransactionResult. Each entry represents the result of resetting a particular currency.
 
- 
resetBalancesResets the balances for allCurrencys used on this account to their default values (defaultBalance(Currency)), using the current activeContext.- Returns:
- A map of CurrencytoTransactionResult. Each entry represents the result of resetting a particular currency
 
- 
resetBalanceResets the balance for the specifiedCurrencyto its default value (defaultBalance(Currency)), using the specifiedContexts.
- 
resetBalanceResets the balance for the specifiedCurrencyto its default value (defaultBalance(Currency)), using context from the specifiedCause.- Parameters:
- currency- The- Currencyto reset the balance for
- cause- The cause to use to compute context when resetting the balance
- Returns:
- The result of the transaction
 
- 
resetBalanceResets the balance for the specifiedCurrencyto its default value (defaultBalance(Currency)), using the current activeContexts.- Parameters:
- currency- The- Currencyto reset the balance for
- Returns:
- The result of the transaction
 
- 
deposit
- 
deposit
- 
deposit
- 
withdraw
- 
withdraw
- 
withdraw
- 
transferTransfers the specified amount of the specifiedCurrencyfrom this account the destination account, using the specifiedContexts.This operation is a merged withdraw(Currency, BigDecimal, Cause)from this account with adeposit(Currency, BigDecimal, Cause)into the specified account.- Parameters:
- to- the Account to transfer the amounts to.
- currency- The- Currencyto transfer the specified amount for
- amount- The amount to transfer for the specified- Currency
- contexts- The- Contexts to use with the specified- Currencyand account
- Returns:
- A TransferResultrepresentative of the effects of the operation
 
- 
transferTransfers the specified amount of the specifiedCurrencyfrom this account the destination account, using the specifiedCause.This operation is a merged withdraw(Currency, BigDecimal, Cause)from this account with adeposit(Currency, BigDecimal, Cause)into the specified account.- Parameters:
- to- the Account to transfer the amounts to.
- currency- The- Currencyto transfer the specified amount for
- amount- The amount to transfer for the specified- Currency
- cause- The cause to use with the specified- Currencyand account
- Returns:
- A TransferResultrepresentative of the effects of the operation
 
- 
transferTransfers the specified amount of the specifiedCurrencyfrom this account the destination account, using the current activeContexts.This operation is a merged withdraw(Currency, BigDecimal, Cause)from this account with adeposit(Currency, BigDecimal, Cause)into the specified account.- Parameters:
- to- the Account to transfer the amounts to.
- currency- The- Currencyto transfer the specified amount for
- amount- The amount to transfer for the specified- Currency
- Returns:
- A TransferResultrepresentative of the effects of the operation
 
 
-