-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Minor
-
None
-
Affects Version/s: None
-
None
-
This server is running CraftBukkit version 4402-Spigot-33ece3e-665900b (MC: 1.21.4) (Implementing API version 1.21.4-R0.1-SNAPSHOT)
-
Yes
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.