hiscoreClient

Methods
2
Fields
None

Getting one

hiscoreClient

Methods

MethodReturnsDescription
lookupAsync(string, HiscoreEndpoint)CompletableFutureThe lookup, started now, as a future: it completes with the player's result, with nil for a player the hiscores do not list (a 404), or e…
lookupCached(string, HiscoreEndpoint)HiscoreResult?The result once it has been fetched, nil until then (poll it); the first call starts the lookup. Never blocks, so it can run on the game…

Method details

lookupAsync

lookupAsync: (HiscoreLookup, string, HiscoreEndpoint) -> CompletableFuture

The lookup, started now, as a future: it completes with the player's result, with nil for a player the hiscores do not list (a 404), or exceptionally with an IOException (any other failure: an error status other than 404, a body that does not parse, a failed request). Read it with whenCompleteAsync(function(result, ex) ... end), which runs on the client thread. Every call is a request (a miss is never remembered); hiscoreManager:lookupAsync is the cached lookup. These lookups have a budget of their own, shared by every plugin's: 32 in flight, 4 at a time; past it a lookup waits in a queue, oldest first, and never holds up hiscoreManager, chatClient or the NPC table. Only a lookup that can never be sent (no HTTP service) fails at once.

lookupCached

lookupCached: (HiscoreLookup, string, HiscoreEndpoint) -> HiscoreResult?

The result once it has been fetched, nil until then (poll it); the first call starts the lookup. Never blocks, so it can run on the game thread. Shares hiscoreManager's cache, so a player with no entry stays nil for an hour (lookupAsync is the uncached call).