If offline mode is enabled, the game uses locally calculated UUIDs for identifying players. If the server owner changes the offline mode during the gameplay (either enable or disable), the UUIDs won't match. This causes loss of inventories and ender chest.
In offline mode, Minecraft uses net.minecraft.world.entity.player.Player.createPlayerUUID(String) to generate a local UUID for each player, including those who logged in with Microsoft account. Its implementation ensures each player name will have its unique corresponding UUID: return UUID.nameUUIDFromBytes(("OfflinePlayer:" + p_36284_).getBytes(StandardCharsets.UTF_8));.
Upon start-up, Minecraft checks if the launch argument contains a UUID, if not, it will use the above method to generate a local one.
When a second player joins the game, Minecraft calls net.minecraft.world.entity.player.Player.createPlayerUUID(GameProfile) to map his UUID:
If offline mode is enabled, the game uses locally calculated UUIDs for identifying players. If the server owner changes the offline mode during the gameplay (either enable or disable), the UUIDs won't match. This causes loss of inventories and ender chest.
net.minecraft.world.entity.player.Player.createPlayerUUID(String)
to generate a local UUID for each player, including those who logged in with Microsoft account. Its implementation ensures each player name will have its unique corresponding UUID:return UUID.nameUUIDFromBytes(("OfflinePlayer:" + p_36284_).getBytes(StandardCharsets.UTF_8));
.When a second player joins the game, Minecraft calls
net.minecraft.world.entity.player.Player.createPlayerUUID(GameProfile)
to map his UUID:To address this issue, the author proposed a new way of generating the UUID:
https://api.mojang.com/users/profiles/minecraft/<username>
See: https://bukkit.org/threads/how-to-convert-uuid-to-name-and-name-to-uuid-uising-mojang-api.460828/