Class AccountManager

java.lang.Object
ovh.mythmc.banco.api.accounts.AccountManager

public final class AccountManager extends Object
  • Field Details

  • Constructor Details

    • AccountManager

      public AccountManager()
  • Method Details

    • registerAccount

      public void registerAccount(@NotNull @NotNull Account account)
      Registers an account
      Parameters:
      account - account to register
    • unregisterAccount

      public void unregisterAccount(@NotNull @NotNull Account account)
      Registers an account
      Parameters:
      account - account to unregister
    • clear

      @Internal public void clear()
    • get

      @NotNull public @NotNull List<Account> get()
      Gets a list of registered accounts
      Returns:
      List of registered accounts
    • get

      public Account get(@NotNull @NotNull UUID uuid)
      Gets a specific account by its UUID
      Parameters:
      uuid - UUID of the player
      Returns:
      UUID's account
    • deposit

      public void deposit(@NotNull @NotNull Account account, @NotNull @NotNull BigDecimal amount)
      Deposits an amount of money to an account
      Parameters:
      account - account that will be modified
      amount - amount of money to deposit
    • withdraw

      public void withdraw(@NotNull @NotNull Account account, @NotNull @NotNull BigDecimal amount)
      Withdraws an amount of money from an account
      Parameters:
      account - account that will be modified
      amount - amount of money to withdraw
    • set

      public void set(@NotNull @NotNull Account account, @NotNull @NotNull BigDecimal amount)
      Sets an account's balance to a specified amount
      Parameters:
      account - account that will be modified
      amount - amount of money to set
    • has

      public boolean has(@NotNull @NotNull Account account, @NotNull @NotNull BigDecimal amount)
      Checks if an account has an amount of money
      Parameters:
      account - account to check
      amount - amount to check
      Returns:
      true if account has more than the specified amount
    • amount

      @NotNull public @NotNull BigDecimal amount(@NotNull @NotNull Account account)
      Gets an account's balance
      Parameters:
      account - account to check
      Returns:
      Account's balance
    • updateTransactions

      @Internal public void updateTransactions(@NotNull @NotNull Account account)
    • getTop

      public LinkedHashMap<UUID,BigDecimal> getTop(int limit)
      Gets a LinkedHashMap ordered by players with the highest balance
      Parameters:
      limit - how many entries should map return
      Returns:
      A LinkedHashMap ordered by players with the highest balance
    • getTopPosition

      public Map.Entry<UUID,BigDecimal> getTopPosition(int pos)
      Gets an entry with the account's UUID and balance at the specified top position
      Parameters:
      pos - position to get
      Returns:
      An entry with account's UUID and money amount