Class PlayerAccount

java.lang.Object
dev.satyrn.xpeconomy.economy.PlayerAccount
All Implemented Interfaces:
Account

public final class PlayerAccount extends Object implements Account
Represents a player account. Handles all XP operations.
  • Constructor Details

    • PlayerAccount

      public PlayerAccount(Configuration configuration, UUID uuid)
      Creates an account with a name and UUID.
      Parameters:
      configuration - The configuration instance.
      uuid - The UUID on the account.
  • Method Details

    • getName

      @Contract("-> !null") @NotNull public @NotNull String getName()
      Gets the name of the account owner.
      Specified by:
      getName in interface Account
      Returns:
      The account owner's name.
    • setName

      @Contract(value="_ -> this", mutates="this") @NotNull public @NotNull Account setName(@NotNull @NotNull String name)
      Sets the account owner's name.
      Specified by:
      setName in interface Account
      Parameters:
      name - The new account owner name.
      Returns:
      The modified account.
    • getUUID

      @NotNull public @NotNull UUID getUUID()
      Gets the account owner's player UUID.
      Specified by:
      getUUID in interface Account
      Returns:
      The player UUID of the account owner.
    • setUUID

      @NotNull public @NotNull Account setUUID(@NotNull @NotNull UUID value)
      Sets the account owner's player UUID.
      Specified by:
      setUUID in interface Account
      Parameters:
      value - The account owner's UUID.
      Returns:
      The account instance.
    • getBalance

      @NotNull public @NotNull BigDecimal getBalance()
      Gets the balance on the account.
      Specified by:
      getBalance in interface Account
      Returns:
      The account balance.
    • setBalance

      @NotNull public @NotNull PlayerAccount setBalance(@NotNull @NotNull BigDecimal value)
      Sets the balance on the account.
      Specified by:
      setBalance in interface Account
      Parameters:
      value - The new account balance.
      Returns:
      The account instance.
    • getBalanceRaw

      @NotNull public @NotNull BigInteger getBalanceRaw()
      Description copied from interface: Account
      Gets the raw experience point value on the account.
      Specified by:
      getBalanceRaw in interface Account
      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 interface Account
      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 interface Account
      Parameters:
      value - The experience point balance.
      updateXPValue - If true, also updates the player's XP to match.
      Returns:
      The account instance.
    • has

      public boolean has(@NotNull @NotNull BigDecimal value)
      Checks whether the account can withdraw a given amount.
      Specified by:
      has in interface Account
      Parameters:
      value - The amount to withdraw.
      Returns:
      Whether the account can withdraw a given amount.
    • withdraw

      public boolean withdraw(@NotNull @NotNull BigDecimal value)
      Withdraws a given amount from the account.
      Specified by:
      withdraw in interface Account
      Parameters:
      value - The account to withdraw.
    • deposit

      public boolean deposit(@NotNull @NotNull BigDecimal value)
      Deposits a given amount into the account.
      Specified by:
      deposit in interface Account
      Parameters:
      value - The amount to deposit.