Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix local profile cache. #327

Merged
merged 1 commit into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public static UserProfile loadProfile0(GameProfile gameProfile, boolean isSkull)

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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ private CachedProfile getCachedProfile(String username){
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");
Expand All @@ -99,9 +99,9 @@ private UserProfile loadLocalProfile(String username){
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){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
* @since 13.1
*/
public class UserProfile {

public final static UserProfile NULL = new UserProfile();

/**
* Direct url for skin.
Expand Down
2 changes: 1 addition & 1 deletion build.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
name=CustomSkinLoader
group=customskinloader
version=14.22
version=14.22.1
Loading