mirror of
https://github.com/SKCraft/Launcher.git
synced 2024-11-23 12:05:44 +01:00
Make skin service return null on error
This commit is contained in:
parent
4177c15675
commit
fd78863697
@ -11,6 +11,7 @@ import com.skcraft.launcher.auth.microsoft.model.McAuthResponse;
|
||||
import com.skcraft.launcher.auth.microsoft.model.McProfileResponse;
|
||||
import com.skcraft.launcher.auth.microsoft.model.TokenResponse;
|
||||
import com.skcraft.launcher.auth.microsoft.model.XboxAuthorization;
|
||||
import com.skcraft.launcher.auth.skin.VisageSkinService;
|
||||
import com.skcraft.launcher.util.HttpRequest;
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
@ -1,19 +0,0 @@
|
||||
package com.skcraft.launcher.auth;
|
||||
|
||||
import com.skcraft.launcher.util.HttpRequest;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import static com.skcraft.launcher.util.HttpRequest.url;
|
||||
|
||||
public class VisageSkinService {
|
||||
public static byte[] fetchSkinHead(String uuid) throws IOException, InterruptedException {
|
||||
String skinUrl = String.format("https://visage.surgeplay.com/face/32/%s.png", uuid);
|
||||
|
||||
return HttpRequest.get(url(skinUrl))
|
||||
.execute()
|
||||
.expectResponseCode(200)
|
||||
.returnContent()
|
||||
.asBytes();
|
||||
}
|
||||
}
|
@ -7,6 +7,7 @@
|
||||
package com.skcraft.launcher.auth;
|
||||
|
||||
import com.fasterxml.jackson.annotation.*;
|
||||
import com.skcraft.launcher.auth.skin.VisageSkinService;
|
||||
import com.skcraft.launcher.util.HttpRequest;
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
@ -0,0 +1,25 @@
|
||||
package com.skcraft.launcher.auth.skin;
|
||||
|
||||
import com.skcraft.launcher.util.HttpRequest;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.IOException;
|
||||
|
||||
import static com.skcraft.launcher.util.HttpRequest.url;
|
||||
|
||||
public class VisageSkinService {
|
||||
@Nullable
|
||||
public static byte[] fetchSkinHead(String uuid) throws InterruptedException {
|
||||
String skinUrl = String.format("https://visage.surgeplay.com/face/32/%s.png", uuid);
|
||||
|
||||
try {
|
||||
return HttpRequest.get(url(skinUrl))
|
||||
.execute()
|
||||
.expectResponseCode(200)
|
||||
.returnContent()
|
||||
.asBytes();
|
||||
} catch (IOException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user