Skip to content

Refactor OfflinePlayerArgument population to avoid blocking the server thread - #686

Open
BestBearr wants to merge 2 commits into
Rollczi:masterfrom
BestBearr:master
Open

Refactor OfflinePlayerArgument population to avoid blocking the server thread#686
BestBearr wants to merge 2 commits into
Rollczi:masterfrom
BestBearr:master

Conversation

@BestBearr

@BestBearr BestBearr commented Jul 18, 2026

Copy link
Copy Markdown

Bukkit's Server#getOfflinePlayers method being loaded by the OfflinePlayerArgument causes a huge strain on servers with large player counts. This pull request moves this work to an executor thread. Since getOfflinePlayers is not thread-safe, and I want to target as many versions as possible, I opted to use reflection and raw NBT parsing. The Bukkit approach was too inefficient for what we need - which is the last known username so we can cache it.

An alternative method that could be used is reading the usercache.json, but I find this method too unreliable. Some networks (including my own) do not utilize this file anymore.

@Rollczi

Rollczi commented Jul 18, 2026

Copy link
Copy Markdown
Owner

Ja @BestBearr Thanks for your pull request! Do we know how much version range this change supports?

@BestBearr

Copy link
Copy Markdown
Author

Ja @BestBearr Thanks for your pull request! Do we know how much version range this change supports?

I targeted 1.8 through modern. Personally tested on 1.8.8, 1.21.1, 1.21.4, 1.21.8, and 26.2.

…Argument population

- EXECUTOR type is not implemented on Paper, and I did not want to block the platform executor.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants