Fix Dynamic Skull

This commit is contained in:
xfl03 committed 2016-09-25 11:45:52 +08:00
1 parent b2d6532709
commit e63858d561
2 files changed
+10 -4

No files matched your search

@@ -33,8 +33,8 @@ public class DynamicSkullManager {
public int interval;
public boolean fromZero;
//For program
public long startTime=0;
public int period=1;
public long startTime;
public int period;
}
private Map<GameProfile,SkullTexture> dynamicTextures=new HashMap<GameProfile,SkullTexture>();
private Map<GameProfile,Map<Type,MinecraftProfileTexture>> staticTextures=new HashMap<GameProfile,Map<Type,MinecraftProfileTexture>>();
@@ -62,6 +62,8 @@ public class DynamicSkullManager {
if(!CustomSkinLoader.config.enableDynamicSkull||result.skins==null||result.skins.isEmpty())
return;
CustomSkinLoader.logger.info("Dynamic Skull: "+json);
for(int i=0;i<result.skins.size();i++){//check and cache skins
String skin=result.skins.get(i);
if(HttpUtil0.isLocal(skin)){
@@ -88,7 +90,7 @@ public class DynamicSkullManager {
if(result.skins.isEmpty())//Nothing loaded
return;
result.interval=Math.min(result.interval, 50);
result.interval=Math.max(result.interval, 50);
if(result.fromZero)
result.startTime=System.currentTimeMillis();
result.period=result.interval*result.skins.size();
@@ -117,7 +119,7 @@ public class DynamicSkullManager {
loadingList.remove(profile);
}
};
loadThread.setName("Dynamic Skull "+profile.toString());
loadThread.setName("Skull "+profile.hashCode());
loadThread.start();
return new HashMap();
}
@@ -45,6 +45,10 @@ public class HttpUtil0 {
HttpURLConnection c=null;
try {
CustomSkinLoader.logger.info("Try to save '"+url+"' to '"+target.getAbsolutePath()+"'.");
if(target.isFile()){
CustomSkinLoader.logger.info("Cache file found (Length: "+target.length()+")");
return true;
}
c=createConnection(url,null);
int res = c.getResponseCode()/100;
if (res==4||res==5||c.getResponseCode()==HttpURLConnection.HTTP_NO_CONTENT) {