2323 */
2424package me .glaremasters .guilds .guild ;
2525
26- import com .cryptomorin .xseries .XMaterial ;
2726import com .cryptomorin .xseries .XSkull ;
2827import org .bukkit .entity .Player ;
2928import org .bukkit .inventory .ItemStack ;
30- import org .bukkit .inventory .meta .SkullMeta ;
3129
30+ import java .util .Base64 ;
3231import java .util .Objects ;
3332
3433/**
@@ -44,7 +43,10 @@ public class GuildSkull {
4443 * @param player the player whose head will be used for the guild skull
4544 */
4645 public GuildSkull (Player player ) {
47- itemStack = XSkull .getSkull (player .getUniqueId ());
46+ final XSkull .SkullInstruction <ItemStack > skullInstruction = XSkull .create ();
47+ final XSkull .SkullAction <ItemStack > skullAction = skullInstruction .profile (player );
48+
49+ itemStack = skullAction .apply ();
4850 serialized = XSkull .getSkinValue (Objects .requireNonNull (itemStack .getItemMeta ()));
4951 }
5052
@@ -54,8 +56,10 @@ public GuildSkull(Player player) {
5456 * @param texture the texture string, which should be a Minecraft resource location string
5557 */
5658 public GuildSkull (String texture ) {
57- serialized = XSkull .encodeTexturesURL (texture );
58- itemStack = createSkull ();
59+ final String encoded = Base64 .getEncoder ().encodeToString (texture .getBytes ());
60+ this .serialized = encoded ;
61+
62+ this .itemStack = createSkull ();
5963 }
6064
6165 /**
@@ -64,11 +68,10 @@ public GuildSkull(String texture) {
6468 * @return the guild skull
6569 */
6670 public ItemStack createSkull () {
67- final ItemStack head = XMaterial .PLAYER_HEAD .parseItem ();
68- SkullMeta meta = (SkullMeta ) head .getItemMeta ();
69- meta = XSkull .applySkin (meta , serialized );
70- head .setItemMeta (meta );
71- return head ;
71+ final XSkull .SkullInstruction <ItemStack > skullInstruction = XSkull .create ();
72+ final XSkull .SkullAction <ItemStack > skullAction = skullInstruction .profile (serialized );
73+
74+ return skullAction .apply ();
7275 }
7376
7477 /**
0 commit comments