mirror of
https://github.com/xfl03/MCCustomSkinLoader.git
synced 2026-11-20 14:39:40 +00:00
Remove some useless code
This commit is contained in:
1 parent
1d88a98040
commit
8bccab4f0b
8 files changed
+64
-120
No files matched your search
@@ -20,13 +20,24 @@ import customskinloader.utils.HttpUtil0;
|
||||
public class CustomSkinAPILoader implements IProfileLoader {
|
||||
public static final String TEXTURES="textures/";
|
||||
@Override
|
||||
public UserProfile loadProfile(SkinSiteProfile ssp, GameProfile gameProfile) throws Exception {
|
||||
public UserProfile loadProfile(SkinSiteProfile ssp, GameProfile gameProfile, boolean local) throws Exception {
|
||||
String username=gameProfile.getName();
|
||||
if(ssp.root==null||ssp.root.equals("")){
|
||||
CustomSkinLoader.logger.info("Root not defined.");
|
||||
return null;
|
||||
}
|
||||
String json=HttpUtil0.readHttp(ssp.root+username+".json",ssp.userAgent);
|
||||
String jsonUrl=ssp.root+username+".json";
|
||||
String json;
|
||||
if(local){
|
||||
File jsonFile=new File(jsonUrl);
|
||||
if(!jsonFile.exists()){
|
||||
CustomSkinLoader.logger.info("Profile File not found.");
|
||||
return null;
|
||||
}
|
||||
json=IOUtils.toString(new FileInputStream(jsonFile));
|
||||
}else{
|
||||
json=HttpUtil0.readHttp(jsonUrl,ssp.userAgent);
|
||||
}
|
||||
if(json==null||json.equals("")){
|
||||
CustomSkinLoader.logger.info("Profile not found.");
|
||||
return null;
|
||||
@@ -46,32 +57,6 @@ public class CustomSkinAPILoader implements IProfileLoader {
|
||||
public String skin;
|
||||
public String cape;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserProfile loadLocalProfile(SkinSiteProfile ssp, GameProfile gameProfile) throws Exception {
|
||||
String username=gameProfile.getName();
|
||||
if(ssp.root==null||ssp.root.equals("")){
|
||||
CustomSkinLoader.logger.info("Root not defined.");
|
||||
return null;
|
||||
}
|
||||
File jsonFile=new File(CustomSkinLoader.DATA_DIR,ssp.root+username+".json");
|
||||
if(!jsonFile.exists()){
|
||||
CustomSkinLoader.logger.info("Profile File not found.");
|
||||
return null;
|
||||
}
|
||||
String json=IOUtils.toString(new FileInputStream(jsonFile));
|
||||
if(json==null||json.equals("")){
|
||||
CustomSkinLoader.logger.info("Profile not found.");
|
||||
return null;
|
||||
}
|
||||
UserProfile p=toUserProfile(ssp.root,json,true);
|
||||
if(p.isEmpty()){
|
||||
CustomSkinLoader.logger.info("Both skin and cape not found.");
|
||||
return null;
|
||||
}else{
|
||||
return p;
|
||||
}
|
||||
}
|
||||
|
||||
private UserProfile toUserProfile(String root,String json,boolean local){
|
||||
CustomSkinAPI profile=CustomSkinLoader.GSON.fromJson(json, CustomSkinAPI.class);
|
||||
|
||||
Reference in new issue
Block a user