Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Rewrites how username resolving works in pgm to make it more reliable. At the moment
Unknown
prevails and is shown way too often, this rewrite fixes a big amount of hidden bugs and quirks with the original system like, to name a few:The new resolution system isn't flawless, but it's much better than the predecessor.
There's a series of
UsernameResolver
s, they can work in batch mode (in which case they no-op until the end of the batch) or in normal mode. They return aCompletableFuture
with the result of the resolution. You can setup multiple of them to work in a chain, where the first resolver is tried, if it gives a good answer that's returned via the future, otherwise the next resolver is tried, until one of them gives a good answer, or we run out of resolvers. They can also chain in batching mode where the first will resolve everything (sending downstream the not-well-resolved ones), then the 2nd tries to resolve the remaining batch, and so on.The main caveat that still seems not to work too well is bukkit's username cache, which seems to either not keep users or say their last played time was 0. Using vanilla's user cache via nmshacks seems to work around the issue and allow for "instant resolving" to work just fine.