mirror of
https://github.com/xfl03/MCCustomSkinLoader.git
synced 2026-11-12 18:57:38 +00:00
35 lines
1.0 KiB
Java
35 lines
1.0 KiB
Java
package customskinloader.loader;
|
|
|
|
import customskinloader.CustomSkinLoader;
|
|
import customskinloader.UserProfile;
|
|
import customskinloader.config.SkinSiteProfile;
|
|
import customskinloader.utils.HttpUtil0;
|
|
|
|
public class LegacyLoader implements IProfileLoader {
|
|
public static final String USERNAME_REGEX="\\{USERNAME\\}";
|
|
@Override
|
|
public UserProfile loadProfile(SkinSiteProfile ssp, String username) throws Exception {
|
|
UserProfile profile=new UserProfile();
|
|
if(ssp.skin!=null && !ssp.skin.equals("")){
|
|
String skin=HttpUtil0.getRealUrl(ssp.skin.replaceAll(USERNAME_REGEX, username));
|
|
if(skin!=null&&!skin.equals("")){
|
|
profile.skinUrl=skin;
|
|
profile.model="default";
|
|
}
|
|
}
|
|
if(ssp.cape!=null && !ssp.cape.equals("")){
|
|
String cape=HttpUtil0.getRealUrl(ssp.cape.replaceAll(USERNAME_REGEX, username));
|
|
if(cape!=null&&!cape.equals("")){
|
|
profile.capeUrl=cape;
|
|
}
|
|
}
|
|
if(profile.isEmpty()){
|
|
CustomSkinLoader.logger.info("Both skin and cape not found.");
|
|
return null;
|
|
}else{
|
|
return profile;
|
|
}
|
|
}
|
|
|
|
}
|