-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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(String) #4687
Conversation
Spigot-API-Patches/0231-Add-getOfflinePlayerIfCached-String.patch
Outdated
Show resolved
Hide resolved
Spigot-API-Patches/0231-Add-getOfflinePlayerIfCached-String.patch
Outdated
Show resolved
Hide resolved
Spigot-API-Patches/0231-Add-getOfflinePlayerIfCached-String.patch
Outdated
Show resolved
Hide resolved
IMHO, the deprecations are not needed, they were added by CB to discourage the usage of strings for looking up players, the biggest caveat is around the potential lookups that the standard getOfflinePlayer will induce against Mojang's API, this is not an issue here, and there are perfectly valid cases for looking up by a name, e.g. user commands These deprecations have mostly served their course, only real caveat which I err against removing the one on getOfflinePlayer(String) is due to that "hidden" potential lookup hit, but that's not an issue here, and I'm not really sure it makes sense to expect every plugin that works on offline players to have their own cache when the server already has one, which is now being exposed open to comments, but, I think that the deprecations have mostly run their course, and the only real reason for trying to shove people off them has past |
OK, I will remove the deprecation tag from the method. The reason why I added it is because I didn't know anything you just said at the time and I thought that because getOfflinePlayer(String) was deprecate, I would need to deprecate my method too. |
Tbh, i would probably argue that such method should be called as getLocalOfflinePlayer and should state that this method will return an offline/online player which played locally on a server at least once, otherwise null (won't be the same as current definition tho). The reasoning behind this is that return if cached/not doing a web request is way too abstract definition for that. Also current implementation uses UserCache, which may be entirely disabled, and probably won't work in offline mode. |
I would agree, except the implementation is literally checking against usercache.json which entries do expire from, does get truncated by entry size, can be disabled, and can be altered. So to say it returns an offline player that has played at least once is not factual. You point of making sure this method name represents clearly whats under the hood just verifies the current naming is indeed the correct choice ;) |
22c5009
@limbo-app ready |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request automatically approved for merging - a core team member has previously approved this pull request.
Closes #4264