Add a handler in the case that the player instance is null in Profile

This commit is contained in:
zontreck 2023-12-19 11:06:01 -07:00
parent fdacdeb641
commit 19d99091b7
2 changed files with 14 additions and 2 deletions

View file

@ -69,11 +69,23 @@ public class Profile {
this.accessor = vaultFile;
}
public boolean runSanityChecks()
{
if(player == null) return false;
return true;
}
public static Profile get_profile_of(String UUID) throws UserProfileNotYetExistsException
{
if(LibZontreck.PROFILES.containsKey(UUID)){
return LibZontreck.PROFILES.get(UUID);
Profile prof = LibZontreck.PROFILES.get(UUID);
if(!prof.runSanityChecks())
{
LibZontreck.PROFILES.remove(prof);
return get_profile_of(UUID);
}
return prof;
}else {
// Create or load profile
Path userProfile = BASE.resolve(UUID);