pdinklag / MinecraftStats

A Minecraft player statistics browser for the web - supports 1.13 and later!
https://discord.gg/brH5PGG8By
Other
228 stars 53 forks source link

Problem with player recognition on Offline-server using SkinsRestorer #245

Open TouhouRyujin opened 4 months ago

TouhouRyujin commented 4 months ago

Using latest dev-version, because release 3.3.0 don't support dynmap correctly(not showing any statistics). Server version is 1.20.1 on Purpur core(papermc fork) hosted on Humbleservers. SkinsRestorer version 15.0.13, dynmap version 3.7-beta-3-932 I have encountered problem with recognition of players, because as I see it uses skins as reference not uuid+nicknames(as it should or as I want it to be). As a result statistics is incorrectly assigned to players. Also geyser(plugin for bedrock+java crossplay) maybe be a problem as it uses 00000000-0000-0000-000X-XXXXXXXXXXXX UUID. I think that listed here is only problems that can cause that problem. Screenshot of incorrect nick assignment(number 12 should be nickname TouhouRyujin) image image image Screenshot of all errors in console(as we see related to skins) image

pdinklag commented 4 months ago

If the nicknames are wrong, then they are reported wrong from either of those sources that MinecraftStats uses. That may be due to a bug in MinecraftStats, but I can't tell from just the description. We'll need to do some deeper investigation here.

I'm not sure what exactly you mean by the statement that MinecraftStats uses "skins as reference"? MinecraftStats tries to resolve the nickname using the UUID from various sources, depending on their availability:

First, please double check if SkinsRestorer is detected properly, MinecraftStats should print something about it in your server log when it is loading up (either something like "Using SkinsRestorer" or some error about it).

Second, try deleting the data directory that MinecraftStats generated (no data is lost unless you are using events, because it is still in the server's player stats). Are there any error messages from MinecraftStats when you update after that?

Third, I will need some explanations about the screenshots:

  1. In the first screenshot, you say the nickname is wrong. Did you double check that in your usercache.json? Can you click player rank 3 (TouhouRyujin) and check whether the UUID in the URL is the same as in the usercache.json? Same for Ikhwan0510.
  2. In the second screenshot, you show some entry from usercache.json, but how is it related to the first screenshot? What's wrong here?
  3. In the third screenshot, I see that some texture URLs are apparently invalid, but just the error message doesn't help me. The URLs seem to link to textures.minecraft.net, so Skins Restorer reported it if it was detected. Do you happen to know which players are affected?
TouhouRyujin commented 4 months ago

SkinsRestorer is detected and there is no error about it. [22:31:17] [Server thread/INFO]: [MinecraftStats] Enabling MinecraftStats v3.3.1 [22:31:17] [Server thread/INFO]: [MinecraftStats] Exporting to auto-detected webserver document root: /home/container/plugins/dynmap/web [22:31:21] [Craft Scheduler Thread - 3 - MinecraftStats/INFO]: [MinecraftStats] Using SkinsRestorer v15.0.13 [22:31:25] [Craft Scheduler Thread - 3 - MinecraftStats/INFO]: [MinecraftStats] Web frontend updated.

Second screenshot was from whitelist, but here you can see from usercache.json image

We don't even had a player named Ikhwan0510 image

We can see UUID is not the same as on web and it was replaced with GermaniBoy's UUID Germaniboy used my old minecraft skin as his via SkinsRestorer and on that was based my statement about skins as reference

Third explanation, we have near all players affected expect HumbleShark.

TouhouRyujin commented 4 months ago

I think if minecraftstats would force apply nickname to UUID from usercache.json, problem would be solved

pdinklag commented 4 months ago

I think if minecraftstats would force apply nickname to UUID from usercache.json, problem would be solved

I could make this an option maybe, but I believe there must be a bug in Skins Restorer or whatever generates UUIDs for your server.

I tried to lookup the UUID 743080f9-63dc-3fb9-b206-c3defcf3fb04 and it's not a valid Mojang UUID. Something must have told MinecraftStats that the player name for that UUID is "Ikhwan0510" - MinecraftStats does not randomly invent names. Either it's coming from SkinsRestorer or from your usercache.json, but since you say you have no player with that name, it must come from SkinsRestorer. So as far as I can tell, this is a bug of some kind in SkinsRestorer that I cannot solve.

The same goes for the other UUID bcce4e5f-2ec2-36c1-bc76-b09df055752 - I don't know where it comes from and I can't tell why it's mixed up with a different player. If UUIDs are not "universally unique" as their name suggests, then things are bound to break eventually. This is not something MinecraftStats or anything else could magically resolve. Your stats may be completely wrong due to this even in your raw JSON files. I don't know where your UUIDs are coming from, but it should never be possible to have the same UUID for different players. If this happens, whatever generates them is seriously broken.

TouhouRyujin commented 4 months ago

In minecraft properties online-mode: false, sets UUID to be an MD5 hash of the playername this is the reason you can't find it in mojang UUID's. SkinsRestorer however assigns correct skins for players in the leaderboard, but why then nicknames are wrong?

Where it possibly could got a Ikhwan0510 nickname if he never played on our server nor used any skins that I used. Ikhwan0510 may use SkinsRestorer on another server and set the same skin as my current skin and this can be a reason why in leaderboard my name is changed with him.

Humbleshark uses as I think his custom skin and no one other used his skin, this could be a reason why he was not affected. My first skin was custom too, but Germaniboy uses it right now and I use another skin that is not custom and could be found in internet.

TouhouRyujin commented 4 months ago

I found a problem. Option to take nickname from SkinsRestorer shouldn't even be a thing, because it's uses lastKnownName as reference for nickname and it couldn't resolve if a few players have skin from one source. But I still don't understand from where Ikhwan0510 appeared. First screenshot is from SkinsRestorer .playerskin file Second from SkinsRestorer .player file image image

Fanolcie commented 2 months ago

Any idea how to get rid of this issue? Or how to disable getting names from skinrestorer?

pdinklag commented 2 months ago

Option to take nickname from SkinsRestorer shouldn't even be a thing, because it's uses lastKnownName as reference for nickname and it couldn't resolve if a few players have skin from one source

MinecraftStats needs some source to find out the player name for a UUID because that is not included in the player's stats. So typically it looks for the "last known name" in usercache.json and uses the Mojang API. SkinsRestorer also stores the last known name.

The real issue here is that I do not understand why should I not be able use it? Does Skins Restorer not fill this name from the current server but from somewhere else entirely?

I mean it's probably easy to change things to only get the skin from Skins Restorer but not the name. I would like to avoid this, because entries in usercache.json expire and I may not be able to get a name from there. In these cases I thought I could use the Skins Restorer database as a reliable source for a "last known name", except it doesn't seem to be so reliable because the name can be straight-up wrong.

But even then, if Skins Restorer cannot even get the player name right for a UUID, how and why can it correctly assign skins to a UUID? Does that work at all for offline servers, or have you experienced similar bugs there?