I need to retrieve the Fabric ServerPlayer object from the DataSaveEvent event and use it to retrieve data for certain mods, such as Trinkett, and store it in the database.
But when the DataSaveEvent event is triggered, I try to
ServerPlayer serverPlayer = server.getPlayerList().getPlayer(player.getUuid());
The returned server player is null. This indicates that the server-side player object was already deleted by Fabric before the event was triggered. Is there any other way for me to retrieve the mod's data and synchronize it when the player disconnects?
Please help me, I have been researching for two days now