Fix local profile cache. (#327)

This commit is contained in:
ZekerZhayard authored and GitHub committed 2025-01-24 14:27:55 +08:00
1 parent 5764d81d6d
commit 2f26a07dc9
4 files changed
+7 -5

No files matched your search

@@ -180,7 +180,7 @@ public class CustomSkinLoader {
if (config.enableLocalProfileCache) {
UserProfile profile = profileCache.getLocalProfile(credential);
if (profile == null) {
if (profile == null || profile.equals(UserProfile.NULL)) {
logger.info(username + "'s LocalProfile not found.");
} else {
profileCache.updateCache(credential, profile, false);
@@ -89,7 +89,7 @@ public class ProfileCache {
private UserProfile loadLocalProfile(String username){
File localProfile=new File(PROFILE_CACHE_DIR,username.toLowerCase()+".json");
if(!localProfile.exists()){
localProfiles.put(username.toLowerCase(), null);
localProfiles.put(username.toLowerCase(), UserProfile.NULL);
}
try{
String json = FileUtils.readFileToString(localProfile, "UTF-8");
@@ -99,9 +99,9 @@ public class ProfileCache {
return profile;
}catch(Exception e){
CustomSkinLoader.logger.info("Failed to load LocalProfile.("+e.toString()+")");
localProfiles.put(username.toLowerCase(), null);
localProfiles.put(username.toLowerCase(), UserProfile.NULL);
}
return null;
return UserProfile.NULL;
}
@SuppressWarnings("ResultOfMethodCallIgnored")
private void saveLocalProfile(String username, UserProfile profile){
@@ -15,6 +15,8 @@ import customskinloader.profile.ModelManager0.Model;
* @since 13.1
*/
public class UserProfile {
public final static UserProfile NULL = new UserProfile();
/**
* Direct url for skin.
+1 -1
View File
@@ -1,3 +1,3 @@
name=CustomSkinLoader
group=customskinloader
version=14.22
version=14.22.1