Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add getOfflinePlayerIfCached(UUID) #11644

Open
OoLunar opened this issue Nov 22, 2024 · 3 comments
Open

Add getOfflinePlayerIfCached(UUID) #11644

OoLunar opened this issue Nov 22, 2024 · 3 comments
Labels
resolution: awaiting response Additional information is required from the issue reporter

Comments

@OoLunar
Copy link

OoLunar commented Nov 22, 2024

Is your feature request related to a problem?

#4687 allows us to easily search the usercache.json file, however there's no UUID overload for the method even though the usercache.json file saves the player's UUID.

Describe the solution you'd like.

Adding an getOfflinePlayerIfCached(UUID) overload for the getOfflinePlayerIfCached(String) method.

Describe alternatives you've considered.

Calling getOfflinePlayer(UUID), however that has the possibility of making an HTTP request. As this method will be called upon extensively - though results could be cached - this isn't ideal.

Other

No response

@Abelkrijgtalles
Copy link
Contributor

Made a pr, don't know why it wouldn't be merged. Seems like a good idea.

@emilyy-dev
Copy link
Member

Server#getOfflinePlayer(UUID) does not make any HTTP requests like getOfflinePlayer(String) does, it will get or create an OfflinePlayer instance that might or might not be backed by an existing player.dat file for that UUID, for which you can check with OfflinePlayer#hasPlayedBefore().

@lynxplay lynxplay added resolution: awaiting response Additional information is required from the issue reporter and removed status: needs triage labels Nov 23, 2024
@lynxplay
Copy link
Contributor

@OoLunar as emily said, we'd love to hear your usecase for this.
Cluttering API without a proper usecase is generally not in our interest, so it'd be great if you can give us a proper example :)
Otherwise I'll just close this issue as, yea, the uuid getters do not require a network request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
resolution: awaiting response Additional information is required from the issue reporter
Projects
None yet
Development

No branches or pull requests

4 participants