Skip to content

Commit

Permalink
Added more documentation and push to version 3.4.5
Browse files Browse the repository at this point in the history
  • Loading branch information
darbyjack committed May 11, 2019
1 parent 7090b7d commit ade1bf1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

<groupId>me.glaremasters</groupId>
<artifactId>guilds</artifactId>
<version>3.4.5-BETA</version>
<version>3.4.5-RELEASE</version>
<packaging>jar</packaging>

<name>Guilds</name>
Expand Down
15 changes: 15 additions & 0 deletions src/main/java/me/glaremasters/guilds/utils/SkullUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,32 @@
*/
public class SkullUtils {

/**
* Get the encoded skin url
* @param skinUrl the url of the skin
* @return encoded
*/
public static String getEncoded(String skinUrl) {
byte[] encodedData = Base64.getEncoder().encode(String.format("{textures:{SKIN:{url:\"%s\"}}}", skinUrl).getBytes());
return new String(encodedData);
}

/**
* Create a game profile object
* @param url the url to use
* @return game profile
*/
public static GameProfile getGameProfile(String url) {
GameProfile profile = new GameProfile(UUID.randomUUID(), null);
profile.getProperties().put("textures", new Property("textures", url));
return profile;
}

/**
* Get the skull from a url
* @param skinUrl url to use
* @return skull
*/
public static ItemStack getSkull(String skinUrl) {
ItemStack head = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);
if (skinUrl.isEmpty()) return head;
Expand Down

0 comments on commit ade1bf1

Please sign in to comment.