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
ConstructorDescriptionPlayerAccount
(Configuration configuration, UUID uuid) Creates an account with a name and UUID. -
Method Summary
Modifier and TypeMethodDescriptionboolean
deposit
(@NotNull BigDecimal value) Deposits a given amount into the account.@NotNull BigDecimal
Gets the balance on the account.@NotNull BigInteger
Gets the raw experience point value on the account.@NotNull String
getName()
Gets the name of the account owner.@NotNull UUID
getUUID()
Gets the account owner's player UUID.boolean
has
(@NotNull BigDecimal value) Checks whether the account can withdraw a given amount.@NotNull PlayerAccount
setBalance
(@NotNull BigDecimal value) Sets the balance on the account.@NotNull PlayerAccount
setBalance
(@NotNull BigDecimal value, boolean updateXPValue) Sets the balance on the account and optionally updates the player's XP value.@NotNull PlayerAccount
setBalanceRaw
(@NotNull BigInteger value, boolean updateXPValue) Sets the raw balance value.@NotNull Account
Sets the account owner's name.@NotNull Account
Sets the account owner's player UUID.boolean
withdraw
(@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:
getBalance
in interfaceAccount
- Returns:
- The account balance.
-
setBalance
Sets the balance on the account.- Specified by:
setBalance
in interfaceAccount
- Parameters:
value
- The new account balance.- Returns:
- The account instance.
-
getBalanceRaw
Description copied from interface:Account
Gets the raw experience point value on the account.- Specified by:
getBalanceRaw
in 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:
setBalance
in 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:
setBalanceRaw
in 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.
-