MineskinClient
v2 (#17)
api.mineskin.org용 클라이언트
피부 이미지 파일에서 유효한 텍스처 데이터를 생성하는 데 사용할 수 있습니다.
또한mineskin.org를 사용하여 이미지에서 피부 데이터를 직접 생성할 수도 있습니다.
API를 사용하려면 스킨 텍스처를 업로드하기 위해 공식 Minecraft 계정이 필요합니다.
적극적으로 사용하지 않는 Minecraft 계정을 소유하고 있고 API 속도에 기여하고 싶다면 여기에 계정을 추가하세요!
public class Example {
private static final MineSkinClient CLIENT = MineSkinClient . builder ()
. requestHandler ( JsoupRequestHandler :: new )
. userAgent ( "MyMineSkinApp/v1.0" )
. apiKey ( "your-api-key" )
. build ();
public static void main ( String [] args ) throws FileNotFoundException {
GenerateOptions options = GenerateOptions . create ()
. name ( "My Skin" )
. visibility ( Visibility . PUBLIC );
File file = new File ( "skin.jpg" );
CLIENT . generateUpload ( file , options )
. thenAccept ( response -> {
// get generated skin
Skin skin = response . getSkin ();
System . out . println ( skin );
})
. exceptionally ( throwable -> {
throwable . printStackTrace ();
if ( throwable instanceof CompletionException completionException ) {
throwable = completionException . getCause ();
}
if ( throwable instanceof MineSkinRequestException requestException ) {
// get error details
MineSkinResponse response = requestException . getResponse ();
System . out . println ( response . getMessageOrError ());
}
return null ;
});
CLIENT . getSkinByUuid ( "skinuuid" )
. thenAccept ( response -> {
// get existing skin
Skin skin = response . getSkin ();
System . out . println ( skin );
});
}
}
< depencies >
< dependency >
< groupId >org.mineskin</ groupId >
< artifactId >java-client</ artifactId >
< version >2.1.1-SNAPSHOT</ version >
</ dependency >
< dependency >
< groupId >org.mineskin</ groupId >
< artifactId >java-client-jsoup</ artifactId >
< version >2.1.1-SNAPSHOT</ version >
</ dependency >
<!-- alternatively use apache httpcommons -->
<!-- <dependency> -->
<!-- <groupId>org.mineskin</groupId> -->
<!-- <artifactId>java-client-apache</artifactId> -->
<!-- <version>2.1.1-SNAPSHOT</version> -->
<!-- </dependency> -->
<!-- ... or java 11 HttpRequest -->
<!-- <dependency> -->
<!-- <groupId>org.mineskin</groupId> -->
<!-- <artifactId>java-client-java11</artifactId> -->
<!-- <version>2.1.1-SNAPSHOT</version> -->
<!-- </dependency> -->
</ depencies >
< repositories >
< repository >
< id >inventive-repo</ id >
< url >https://repo.inventivetalent.org/repository/public/</ url >
</ repository >
</ repositories >