Package com.earth2me.essentials
Class BalanceTopImpl
java.lang.Object
com.earth2me.essentials.BalanceTopImpl
- All Implemented Interfaces:
BalanceTop
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.essentialsx.api.v2.services.BalanceTop
BalanceTop.Entry
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionRe-calculates the balance top cache asynchronously.Gets the balance top cache or an empty list if one has not been calculated yet.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.long
Gets the epoch time (in mills.) that the baltop cache was last updated at.boolean
Checks to see ifBalanceTop.calculateBalanceTopMapAsync()
is still in the process of calculating the map.
-
Constructor Details
-
BalanceTopImpl
-
-
Method Details
-
calculateBalanceTopMapAsync
Description copied from interface:BalanceTop
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 runBalanceTop.getBalanceTopCache()
to get the newly updated cache- Specified by:
calculateBalanceTopMapAsync
in interfaceBalanceTop
- Returns:
- A future which completes after the balance top cache has been calculated.
-
getBalanceTopCache
Description copied from interface:BalanceTop
Gets the balance top cache or an empty list if one has not been calculated yet. The balance top cache is aMap
which maps the UUID of the player to aBalanceTop.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
BalanceTop.calculateBalanceTopMapAsync()
to manually update this cache yourself.- Specified by:
getBalanceTopCache
in interfaceBalanceTop
- Returns:
- The balance top cache.
- See Also:
-
getCacheAge
public long getCacheAge()Description copied from interface:BalanceTop
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.- Specified by:
getCacheAge
in interfaceBalanceTop
- Returns:
- The epoch time (in mills.) since last cache update or zero.
-
getBalanceTopTotal
Description copied from interface:BalanceTop
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.- Specified by:
getBalanceTopTotal
in interfaceBalanceTop
- Returns:
- The total amount of money in the economy or zero.
- See Also:
-
isCacheLocked
public boolean isCacheLocked()Description copied from interface:BalanceTop
Checks to see ifBalanceTop.calculateBalanceTopMapAsync()
is still in the process of calculating the map.- Specified by:
isCacheLocked
in interfaceBalanceTop
- Returns:
- true if the balance top cache is still in the process of being calculated, otherwise false.
-