Merge pull request #2447 from BentoBoxWorld/2446_new_player_cannot_load_console_error

Fix for #2446 that showed console error when player joined.
This commit is contained in:
tastybento 2024-07-27 13:18:27 -07:00 committed by GitHub
commit ad10205c99
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -84,9 +84,11 @@ public class PlayersManager {
Objects.requireNonNull(playerUUID, "Player UUID must not be null"); Objects.requireNonNull(playerUUID, "Player UUID must not be null");
// If the player exists in the database, load it; otherwise, create and save a new player // If the player exists in the database, load it; otherwise, create and save a new player
Players player = loadPlayer(playerUUID); if (handler.objectExists(playerUUID.toString())) {
if (player != null) { Players p = loadPlayer(playerUUID);
return player; if (p != null) {
return p;
}
} }
Players newPlayer = new Players(plugin, playerUUID); Players newPlayer = new Players(plugin, playerUUID);
handler.saveObjectAsync(newPlayer); handler.saveObjectAsync(newPlayer);