Username matching has issues?
Kakifrucht opened this issue ยท 7 comments
I had multiple issues with /openinv playername.
One issue is where a player is called "BlaOldname". If he wants to access "Oldname", he can't, as using /inv Oldname will open the inventory of "BlaOldname".
Another thing which I can't reproduce is that some players don't get matched at all (if offline). If I can reproduce it I will let you know, however maybe you find the issue yourself somehow.
Let me know if you're still having issues with some offline players not getting matched at all. If you can find one, last seen dates on them may be of use as well.
I'm loath to include any sort of direct lookups via Mojang - loading and caching that sort of stuff seems beyond the scope of OpenInv.
fwiw I'd be in favor of another toggle (yes again) for offline player matching - I prefer using exact names all the time, as tab-complete is no problem for online players.
After some more reading, I don't want to including a toggle.
The second half of this issue is likely caused by the UserCache not containing the details of the player in question. CraftServer#getOfflinePlayer can only return players contained in the cache. While yes, loading an OfflinePlayer for every player to have played is not optimal, we don't run into the horrendous lag issues that OpenInv used to because the lookup is done asynchronously. I only have 3600ish player data files, but when I tried spamming /oi with random strings, the return was pretty quick (~2 seconds at worst) with negligible impact. It seems like a premature optimization - the servers that are more likely to need access to uncached players, the ones with a large playerbase, are the only ones that could really suffer for it.
Now, yes, you could argue, "I don't care about anyone not in the cache." That's great, assuming you don't misspell names and the users are actually in the cache, you'll never hit the search.
If it is actually a serious problem for you I'll include it, but I honestly don't think it's worth bothering with.
Edit: Should also mention I'm planning on including a UUID-based lookup, probably.
This is a tricky one. I may attempt to solve it by adapting what OpenInv used to do in the fun laggy days. I don't entirely want to give up matching, but your case is certainly a problem. Before, OpenInv would search every offline player's name and find the best match. Currently my fork matches online players, then if none are found uses an exact offline player.
I believe the second part of your issue would be caused by users not being cached (or being cached with a previous name) and then not being looked up from Mojang, resulting in them being considered never to have played. Matching offline players would probably also partially fix that.
I think what I will do is change matching to exact online player > exact offline player > match online player > match offline player. This still won't be perfect, but it'll work for your purposes at least.