@@ -32,8 +32,9 @@ public static Property setSkinFromFile(String skinFilePath, boolean useSlim) {
3232 Logging .debug ("Fetching skin from file: " + skinFilePath );
3333 File skinFile = new File (skinFilePath );
3434 try (FileInputStream input = new FileInputStream (skinFile )) {
35- Logging .debug ("Checking file type: " + input .read ());
36- if (input .read () == 137 ) {
35+ var fileType = input .read ();
36+ Logging .debug ("Checking file type: " + fileType );
37+ if (fileType == 137 ) {
3738 // Check image dimensions
3839 BufferedImage image = ImageIO .read (skinFile );
3940 if (image .getWidth () != 64 || (image .getHeight () != 64 && image .getHeight () != 32 )) {
@@ -43,7 +44,7 @@ public static Property setSkinFromFile(String skinFilePath, boolean useSlim) {
4344
4445 try {
4546 Logging .debug ("Uploading skin to MineSkin." );
46- String reply = urlRequest (URI .create ("https://api.mineskin.org/generate/upload?model=" + (useSlim ? "slim" : "steve" )).toURL (), false , skinFile );
47+ String reply = urlRequest (URI .create ("https://api.mineskin.org/generate/upload?v2=true& model=" + (useSlim ? "slim" : "steve" )).toURL (), false , skinFile );
4748 return getSkinFromReply (reply );
4849 } catch (IOException e ) {
4950 // Error uploading
@@ -67,7 +68,7 @@ public static Property setSkinFromFile(String skinFilePath, boolean useSlim) {
6768 public static Property fetchSkinByUrl (String skinUrl , boolean useSlim ) {
6869 Logging .debug ("Fetching skin from URL: " + skinUrl );
6970 try {
70- URL url = URI .create (String .format ("https://api.mineskin.org/generate/url?url=%s&model=%s" , URLEncoder .encode (skinUrl , StandardCharsets .UTF_8 ), useSlim ? "slim" : "steve" )).toURL ();
71+ URL url = URI .create (String .format ("https://api.mineskin.org/generate/url?v2=true& url=%s&model=%s" , URLEncoder .encode (skinUrl , StandardCharsets .UTF_8 ), useSlim ? "slim" : "steve" )).toURL ();
7172 String reply = urlRequest (url , false , null );
7273 return getSkinFromReply (reply );
7374 } catch (IOException e ) {
0 commit comments