MineskinClient
v2 (#17)
Klien untuk api.mineskin.org
Dapat digunakan untuk menghasilkan data tekstur yang valid dari file gambar kulit.
Anda juga dapat menggunakanmineskin.org untuk langsung menghasilkan data kulit dari gambar.
API memerlukan akun Minecraft resmi untuk mengunggah tekstur kulit.
Jika Anda memiliki akun Minecraft yang tidak digunakan secara aktif dan ingin berkontribusi pada kecepatan API, tambahkan akun Anda di sini!
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 >