From 19d99091b70848a8cb3bfd5eeb9fe81829d18c95 Mon Sep 17 00:00:00 2001 From: zontreck Date: Tue, 19 Dec 2023 11:06:01 -0700 Subject: [PATCH] Add a handler in the case that the player instance is null in Profile --- gradle.properties | 2 +- .../dev/zontreck/libzontreck/profiles/Profile.java | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 4fceaab..25dc867 100644 --- a/gradle.properties +++ b/gradle.properties @@ -53,7 +53,7 @@ mod_name=Zontreck Library Mod # The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default. mod_license=GPLv3 # The mod version. See https://semver.org/ -mod_version=1.9.121823.1318 +mod_version=1.9.121923.1104 # The group ID for the mod. It is only important when publishing as an artifact to a Maven repository. # This should match the base package used for the mod sources. # See https://maven.apache.org/guides/mini/guide-naming-conventions.html diff --git a/src/main/java/dev/zontreck/libzontreck/profiles/Profile.java b/src/main/java/dev/zontreck/libzontreck/profiles/Profile.java index 0ce7493..fccb118 100644 --- a/src/main/java/dev/zontreck/libzontreck/profiles/Profile.java +++ b/src/main/java/dev/zontreck/libzontreck/profiles/Profile.java @@ -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);