lishid / OpenInv

Open anyone's inventory as a chest, real-time!
GNU General Public License v3.0
120 stars 97 forks source link

Opening wrong inventories #125

Closed xtomyserrax closed 4 years ago

xtomyserrax commented 4 years ago

Hey, Im having this issue in which openinv is just opening wrong offline players inventories and it is happening with all players.

For example let me explain with the pictures im sending: I do /openinv serpient23 and it opens me the inventory or enderchest of geri33. geri33 in this case was online, but I can do it with other offline players and it opens the inventory of another different offline player. This happens sometimes and when it does, it happens with all offline inventories

Here you have screenshots showing you what Im doing, and also a /seen showing that player has played. https://imgur.com/a/zzRDR9U

Im using latest spigot version and latest OpenInv version (4.0.8)

Do you have an idea of how I can fix it or is it a plugin bug? Let me know if you need more information. Thanks!

RoboMWM commented 4 years ago

What's your server configuration? Online mode? Bungee?

xtomyserrax commented 4 years ago

Heyy server is with online mode set to false and yes its using BungeeCord. What do you mean with server configuration? Or it was that info?

Jikoo commented 4 years ago

The contents of spigot.yml would be useful, along with the entry for those users from your usercache.json - the way OpenInv checks players by name goes online exact, offline exact using Spigot's cache, and then by comparing every offline player's name to the searched text. The only point of failure I can see being OpenInv's fault is the string metric not correctly comparing the names.

xtomyserrax commented 4 years ago

Basicly the behaviour works like this: OpenInv works perfectly fine in some servers, with the exception of one in which it is failing every time despite server reloads. It is just giving wrong inventories to all offline players, not just one, but all, it fails with every single name you give. But this doesnt happen in all servers, so Im not sure to tell you what causes this to happen.

Will let you know if I can send you those files or if I notice something else about this behaviour

EDIT: I just noticed that it works fine with players that recently disconnected, maybe it loses the information when the server restarts? And it is opening the inventories of players that recently disconnected, here you have two videos:

Jikoo commented 4 years ago

Sounds very much like the user cache is returning incorrect UUIDs, but hard to be sure without the files I mentioned. Do partial matches still pull the correct user, I.E. if geri33's inventory opens properly and you try to open geri3, will it still open geri33?

xtomyserrax commented 4 years ago

Will send you the files as soon as I can!

Look at this new video, server just restarted, so now every offline player inventory I try to open, instead of opening the one I asked, it is opening inventories from online players. https://imgur.com/a/hXihUw4

And about the geri33 and geri3 yes it would open geri33's inventory if it is loaded in the cache.

Jikoo commented 4 years ago

In that case, it's probably your user cache being messed up. OpenInv depends on the server for everything except matching-based player selection. If the user cache is messed up, it'll fail before hitting username matching. You can try other inexact names to force it to search to see if that's the case.

Edit: For reference, OpenInv's matching system: 1st check: UUID 2nd check: Exact match for online player (depends on online list) 3rd check: Exact match for offline player (depends on user cache) 4th check: Inexact online match (server implementation - shortest name prefixed with specified content) Final check: Inexact offline match

xtomyserrax commented 4 years ago

Hmm you mean about this? https://imgur.com/a/A40MGwv and https://imgur.com/a/kBhBx5Y

The weird thing is that this is not returning the player right? I mean the majority of times it should work? player = Bukkit.getServer().getOfflinePlayer(name);

So the cache then is doing weird things I guess? Because it starts working bad when server restarts, and only works with offline players who played after the server restarted

Jikoo commented 4 years ago

Yeah, that very much seems like an issue with the server, surprised you're not seeing any issues in other plugins. Please try deleting and reinstalling OpenInv and the server software. If issues persist, please delete usercache.json.

Jikoo commented 4 years ago

Closing due to lack of response, seems to be an issue with server setup/software.