Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

set skin minecraft entity player

public static boolean setSkin(GameProfile profile, UUID uuid) {
    try {
        HttpsURLConnection connection = (HttpsURLConnection) new URL(String.format("https://sessionserver.mojang.com/session/minecraft/profile/%s?unsigned=false", UUIDTypeAdapter.fromUUID(uuid))).openConnection();
        if (connection.getResponseCode() == HttpsURLConnection.HTTP_OK) {
            String reply = new BufferedReader(new InputStreamReader(connection.getInputStream())).readLine();
            String skin = reply.split(""value":"")[1].split(""")[0];
            String signature = reply.split(""signature":"")[1].split(""")[0];
            profile.getProperties().put("textures", new Property("textures", skin, signature));
            return true;
        } else {
            System.out.println("Connection could not be opened (Response code " + connection.getResponseCode() + ", " + connection.getResponseMessage() + ")");
            return false;
        }
    } catch (IOException e) {
        e.printStackTrace();
        return false;
    }
}
Comment

PREVIOUS NEXT
Code Example
Java :: how to shorten if else if and else in java 
Java :: how does java knows where it has stored primitive data type 
Java :: enhanced 4 loop 
Java :: java windowbuilder full screen 
Java :: change password swing gui 
Java :: this java 
Java :: verificar numero par ou impar jacva 
Java :: how to find the maximum value of an attribute of an item in a stream java 
Java :: textbox to arraylist 
Java :: java como comprobar que un numero es entero? 
Java :: variable for java 
Java :: java add backslash into string 
Java :: Java Overloading by changing the number of parameters 
Java :: dependency maven mvn assertj asserting testing framework 
Java :: getcokor from drawable in java android studio 
Java :: logger output to console twice java 
Java :: how to get the last vowel of a string in java 
Java :: Deal with empty or blank cell in excel file using apache poi 
Java :: spring mvc aop transaction management 
Java :: how to add value in jcombobox in java 
Java :: Small Change 
Java :: check whether an entry in hashmap is deleted in java 
Java :: system.out.print 
Java :: jadavpur university 
Java :: fibonacci series 
Java :: truncar a 2 decimales java 
Java :: setting up javafx in eclipse 
Java :: java importing 
Java :: convert long to localdatetime java 
Java :: find power of number in method java 
ADD CONTENT
Topic
Content
Source link
Name
9+7 =