use of org.spongepowered.common.entity.player.SpongeUser in project SpongeCommon by SpongePowered.
the class UserDiscoverer method getFromStoredData.
private static User getFromStoredData(org.spongepowered.api.profile.GameProfile profile) {
// Always cache user to avoid constant lookups in storage when file does not exist
final User user = create((GameProfile) profile);
// Note: Uses the overworld's player data
final File dataFile = getPlayerDataFile(profile.getUniqueId());
if (dataFile == null) {
return null;
}
try {
((SpongeUser) user).readFromNbt(CompressedStreamTools.readCompressed(new FileInputStream(dataFile)));
} catch (IOException e) {
SpongeImpl.getLogger().warn("Corrupt user file {}", dataFile, e);
}
return user;
}
Aggregations