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 >