Skip to content

Commit cb1d700

Browse files
authored
Merge pull request #37 from catfromplan9/update-mojangskinprovider
MojangSkinProvider: avoid hardcoding texture URL
2 parents b1043d0 + 98fe5e9 commit cb1d700

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/main/java/org/mcphackers/launchwrapper/protocol/skin/MojangSkinProvider.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,7 @@ public static Profile getProfile(String uuid) {
155155
if (metadata != null && tex == SkinTexture.SKIN) {
156156
slim = "slim".equals(metadata.optString("model"));
157157
}
158-
String skinURLstr = texJson.optString("url");
159-
texMap.put(tex, skinURLstr.substring(skinURLstr.lastIndexOf('/') + 1));
158+
texMap.put(tex, texJson.optString("url"));
160159
}
161160
}
162161
}
@@ -199,7 +198,8 @@ public MojangSkin(Profile profile, SkinTexture type) {
199198
}
200199

201200
public String getSHA256() {
202-
return profile.textures.get(type);
201+
String skinURLstr = profile.textures.get(type);
202+
return skinURLstr.substring(skinURLstr.lastIndexOf('/') + 1).replaceFirst("\\.png$", "");
203203
}
204204

205205
public InputStream getData() throws IOException {
@@ -211,7 +211,7 @@ public InputStream getData() throws IOException {
211211
}
212212

213213
public String getURL() {
214-
return "http://textures.minecraft.net/texture/" + getSHA256();
214+
return profile.textures.get(type);
215215
}
216216

217217
public boolean isSlim() {

0 commit comments

Comments
 (0)