Will attempt to load missing Player Data, should make the plugin more reliable.

This commit is contained in:
Gunging 2021-11-07 14:04:53 -06:00
parent 07f6c6c396
commit 15918988cf

View File

@ -449,7 +449,16 @@ public class PlayerData {
@NotNull
public static PlayerData get(@NotNull UUID uuid) {
return Objects.requireNonNull(data.get(uuid), "Player data not loaded");
// Might not be null, after all
PlayerData observedData = data.get(uuid);
if (observedData != null) { return observedData; }
// Attempt to load
load(uuid);
// Yes
return Objects.requireNonNull(data.get(uuid), "Could not obtain PlayerData. Please make sure the plugin initialized correctly.");
}
/**