Package dev.satyrn.xpeconomy.economy
Class PlayerAccount
java.lang.Object
dev.satyrn.xpeconomy.economy.PlayerAccount
- All Implemented Interfaces:
Account
Represents a player account. Handles all XP operations.
-
Constructor Summary
ConstructorsConstructorDescriptionPlayerAccount(Configuration configuration, UUID uuid) Creates an account with a name and UUID. -
Method Summary
Modifier and TypeMethodDescriptionbooleandeposit(@NotNull BigDecimal value) Deposits a given amount into the account.@NotNull BigDecimalGets the balance on the account.@NotNull BigIntegerGets the raw experience point value on the account.@NotNull StringgetName()Gets the name of the account owner.@NotNull UUIDgetUUID()Gets the account owner's player UUID.booleanhas(@NotNull BigDecimal value) Checks whether the account can withdraw a given amount.@NotNull PlayerAccountsetBalance(@NotNull BigDecimal value) Sets the balance on the account.@NotNull PlayerAccountsetBalance(@NotNull BigDecimal value, boolean updateXPValue) Sets the balance on the account and optionally updates the player's XP value.@NotNull PlayerAccountsetBalanceRaw(@NotNull BigInteger value, boolean updateXPValue) Sets the raw balance value.@NotNull AccountSets the account owner's name.@NotNull AccountSets the account owner's player UUID.booleanwithdraw(@NotNull BigDecimal value) Withdraws a given amount from the account.
-
Constructor Details
-
PlayerAccount
Creates an account with a name and UUID.- Parameters:
configuration- The configuration instance.uuid- The UUID on the account.
-
-
Method Details
-
getName
Gets the name of the account owner. -
setName
@Contract(value="_ -> this", mutates="this") @NotNull public @NotNull Account setName(@NotNull @NotNull String name) Sets the account owner's name. -
getUUID
Gets the account owner's player UUID. -
setUUID
Sets the account owner's player UUID. -
getBalance
Gets the balance on the account.- Specified by:
getBalancein interfaceAccount- Returns:
- The account balance.
-
setBalance
Sets the balance on the account.- Specified by:
setBalancein interfaceAccount- Parameters:
value- The new account balance.- Returns:
- The account instance.
-
getBalanceRaw
Description copied from interface:AccountGets the raw experience point value on the account.- Specified by:
getBalanceRawin interfaceAccount- Returns:
- The raw experience point balance.
-
setBalance
@NotNull public @NotNull PlayerAccount setBalance(@NotNull @NotNull BigDecimal value, boolean updateXPValue) Sets the balance on the account and optionally updates the player's XP value.- Specified by:
setBalancein interfaceAccount- Parameters:
value- The new account balance.updateXPValue- If true, also updates the player's XP value to match.- Returns:
- The account instance.
-
setBalanceRaw
@NotNull public @NotNull PlayerAccount setBalanceRaw(@NotNull @NotNull BigInteger value, boolean updateXPValue) Sets the raw balance value.- Specified by:
setBalanceRawin interfaceAccount- Parameters:
value- The experience point balance.updateXPValue- If true, also updates the player's XP to match.- Returns:
- The account instance.
-
has
Checks whether the account can withdraw a given amount. -
withdraw
Withdraws a given amount from the account. -
deposit
Deposits a given amount into the account.
-