https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/commits/8d52226914ce4b99f35be3d6954f35616d92476d#src%2Fmain%2Fjava%2Forg%2Fbukkit%2Fcraftbukkit%2Fprofile%2FCraftPlayerProfile.java?f=245
I think we missed to also replace the `getName()` call in the serialization `map.put("name", getName());` to `this.name`. One side effect of this is that an empty name `""` gets converted to null during serialization, which is not considered equal in the CraftPlayerProfile.equals method once loaded again.
Alternatively, we could normalize empty names to null or vice versa. But I am not sure if this would be consistent with Minecraft, i.e. if Minecraft's GameProfile differentiates between non-present and empty name (which I think it does, looking at the decompiled source code), then CraftPlayerProfile should probably mimic that.
And related to that: Minecraft seems to convert ResolvableProfile's non-present Optional name to a GameProfile with an empty name (see ResolvableProfile.resolve()), whereas we convert it to a profile with a null name (see CraftPlayerProfile constructor). This inconsistency might be a problem as well.
|