Interface BalanceTop

All Known Implementing Classes:
BalanceTopImpl

public interface BalanceTop
A class which provides numerous methods to interact with Essentials' balance top calculations.

Note: Implementations of this class should be thread-safe and thus do not need to be called from the server thread.

  • Method Details

    • calculateBalanceTopMapAsync

      CompletableFuture<Void> calculateBalanceTopMapAsync()
      Re-calculates the balance top cache asynchronously.

      This method will return a CompletableFuture<Void> which will be completed upon the recalculation of the balance top map. After which you should run getBalanceTopCache() to get the newly updated cache

      Returns:
      A future which completes after the balance top cache has been calculated.
    • getBalanceTopCache

      Map<UUID,BalanceTop.Entry> getBalanceTopCache()
      Gets the balance top cache or an empty list if one has not been calculated yet. The balance top cache is a Map which maps the UUID of the player to a BalanceTop.Entry object which stores the user's display name and balance. The returned map is sorted by greatest to least wealth.

      There is no guarantee the returned cache is up to date. The balancetop command is directly responsible for updating this cache and does so every two minutes (if executed). See calculateBalanceTopMapAsync() to manually update this cache yourself.

      Returns:
      The balance top cache.
      See Also:
    • getCacheAge

      long getCacheAge()
      Gets the epoch time (in mills.) that the baltop cache was last updated at. A value of zero indicates the cache has not been calculated yet at all.
      Returns:
      The epoch time (in mills.) since last cache update or zero.
    • getBalanceTopTotal

      BigDecimal getBalanceTopTotal()
      Gets the total amount of money in the economy at the point of the last balance top cache calculation or returns zero if no baltop calculation has been made as of yet.
      Returns:
      The total amount of money in the economy or zero.
      See Also:
    • isCacheLocked

      boolean isCacheLocked()
      Checks to see if calculateBalanceTopMapAsync() is still in the process of calculating the map.
      Returns:
      true if the balance top cache is still in the process of being calculated, otherwise false.