feat(event): add warning on load failure

This commit is contained in:
ineanto 2023-12-28 21:09:58 +01:00
parent ff22f5addf
commit 52edd9fa65

View file

@ -37,7 +37,7 @@ public class PlayerJoinListener implements Listener {
nameStore.storeName(player); nameStore.storeName(player);
final Optional<NickoProfile> optionalProfile = dataStore.getData(player.getUniqueId()); final Optional<NickoProfile> optionalProfile = dataStore.getData(player.getUniqueId());
optionalProfile.ifPresent(profile -> { optionalProfile.ifPresentOrElse(profile -> {
// Random Skin on connection feature // Random Skin on connection feature
if (profile.isRandomSkin()) { if (profile.isRandomSkin()) {
final String name = instance.getNameFetcher().getRandomUsername(); final String name = instance.getNameFetcher().getRandomUsername();
@ -61,6 +61,8 @@ public class PlayerJoinListener implements Listener {
)); ));
} }
} }
}, () -> {
instance.getLogger().warning("Failed to load data for " + player.getName());
}); });
for (Player online : Bukkit.getOnlinePlayers().stream().filter(op -> op.getUniqueId() != player.getUniqueId()).toList()) { for (Player online : Bukkit.getOnlinePlayers().stream().filter(op -> op.getUniqueId() != player.getUniqueId()).toList()) {