diff --git a/src/main/java/com/craftaro/skyblock/gui/coop/GuiCoop.java b/src/main/java/com/craftaro/skyblock/gui/coop/GuiCoop.java index 656fd589..b13e1ce8 100644 --- a/src/main/java/com/craftaro/skyblock/gui/coop/GuiCoop.java +++ b/src/main/java/com/craftaro/skyblock/gui/coop/GuiCoop.java @@ -3,6 +3,7 @@ import com.craftaro.core.gui.AnvilGui; import com.craftaro.core.gui.Gui; import com.craftaro.core.gui.GuiUtils; +import com.craftaro.core.utils.SkullItemCreator; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.third_party.com.cryptomorin.xseries.XSound; import com.craftaro.core.utils.TextUtils; @@ -15,8 +16,6 @@ import com.craftaro.skyblock.playerdata.PlayerDataManager; import com.craftaro.skyblock.sound.SoundManager; import com.craftaro.skyblock.utils.player.OfflinePlayer; -import com.craftaro.third_party.com.cryptomorin.xseries.profiles.builder.XSkull; -import com.craftaro.third_party.com.cryptomorin.xseries.profiles.objects.Profileable; import org.bukkit.Bukkit; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.inventory.ItemStack; @@ -154,7 +153,14 @@ public void paint() { targetPlayerTexture = new String[]{null, null}; } } - ItemStack phead = XSkull.createItem().profile(new Profileable.OfflinePlayerProfileable(targetPlayer)).apply(); + + ItemStack phead; + if (targetPlayerTexture.length >= 1 && targetPlayerTexture[0] != null) { + phead = SkullItemCreator.byTextureValue(targetPlayerTexture[0]); + } else { + phead = SkullItemCreator.byUuid(uuid); + } + ItemMeta pheadmeta = phead.getItemMeta(); if (pheadmeta != null) { pheadmeta.setDisplayName(TextUtils.formatText(this.languageLoad.getString("Menu.Coop.Item.Coop.Displayname") diff --git a/src/main/java/com/craftaro/skyblock/gui/wip/GuiBans.java b/src/main/java/com/craftaro/skyblock/gui/wip/GuiBans.java index 42cc4f09..7c8aca8a 100644 --- a/src/main/java/com/craftaro/skyblock/gui/wip/GuiBans.java +++ b/src/main/java/com/craftaro/skyblock/gui/wip/GuiBans.java @@ -2,6 +2,7 @@ import com.craftaro.core.gui.Gui; import com.craftaro.core.gui.GuiUtils; +import com.craftaro.core.utils.SkullItemCreator; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.third_party.com.cryptomorin.xseries.XSound; import com.craftaro.core.utils.TextUtils; @@ -10,8 +11,6 @@ import com.craftaro.skyblock.playerdata.PlayerDataManager; import com.craftaro.skyblock.sound.SoundManager; import com.craftaro.skyblock.utils.player.OfflinePlayer; -import com.craftaro.third_party.com.cryptomorin.xseries.profiles.builder.XSkull; -import com.craftaro.third_party.com.cryptomorin.xseries.profiles.objects.Profileable; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.configuration.file.FileConfiguration; @@ -118,7 +117,13 @@ public void paint() { // TODO Item to add ban } } - ItemStack is = XSkull.createItem().profile(new Profileable.OfflinePlayerProfileable(targetPlayer)).apply(); + ItemStack is; + if (targetPlayerTexture.length >= 1 && targetPlayerTexture[0] != null) { + is = SkullItemCreator.byTextureValue(targetPlayerTexture[0]); + } else { + is = SkullItemCreator.byUuid(uuid); + } + ItemMeta im = is.getItemMeta(); if (im != null) { im.setDisplayName(this.languageLoad.getString("Menu.Bans.Item.Ban.Displayname") diff --git a/src/main/java/com/craftaro/skyblock/menus/Bans.java b/src/main/java/com/craftaro/skyblock/menus/Bans.java index b143565d..5d6f8b57 100644 --- a/src/main/java/com/craftaro/skyblock/menus/Bans.java +++ b/src/main/java/com/craftaro/skyblock/menus/Bans.java @@ -1,6 +1,7 @@ package com.craftaro.skyblock.menus; import com.craftaro.core.gui.AnvilGui; +import com.craftaro.core.utils.SkullItemCreator; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.third_party.com.cryptomorin.xseries.XSound; import com.craftaro.skyblock.SkyBlock; @@ -14,9 +15,6 @@ import com.craftaro.skyblock.sound.SoundManager; import com.craftaro.skyblock.utils.item.nInventoryUtil; import com.craftaro.skyblock.utils.player.OfflinePlayer; -import com.craftaro.third_party.com.cryptomorin.xseries.profiles.builder.XSkull; -import com.craftaro.third_party.com.cryptomorin.xseries.profiles.objects.ProfileInputType; -import com.craftaro.third_party.com.cryptomorin.xseries.profiles.objects.Profileable; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Material; @@ -166,13 +164,13 @@ public void open(Player player) { int playerMenuPage = playerData.getPage(MenuType.BANS), nextEndIndex = islandBans.size() - playerMenuPage * 36; if (playerMenuPage != 1) { - ItemStack Lhead = XSkull.createItem().profile(new Profileable.StringProfileable("3ebf907494a935e955bfcadab81beafb90fb9be49c7026ba97d798d5f1a23", ProfileInputType.TEXTURE_HASH)).apply(); + ItemStack Lhead = SkullItemCreator.byTextureHash("3ebf907494a935e955bfcadab81beafb90fb9be49c7026ba97d798d5f1a23"); nInv.addItem(nInv.createItem(Lhead, configLoad.getString("Menu.Bans.Item.Previous.Displayname"), null, null, null, null), 1); } if (!(nextEndIndex == 0 || nextEndIndex < 0)) { - ItemStack Rhead = XSkull.createItem().profile(new Profileable.StringProfileable("1b6f1a25b6bc199946472aedb370522584ff6f4e83221e5946bd2e41b5ca13b", ProfileInputType.TEXTURE_HASH)).apply(); + ItemStack Rhead = SkullItemCreator.byTextureHash("1b6f1a25b6bc199946472aedb370522584ff6f4e83221e5946bd2e41b5ca13b"); nInv.addItem(nInv.createItem(Rhead, configLoad.getString("Menu.Bans.Item.Next.Displayname"), null, null, null, null), 7); } @@ -209,7 +207,14 @@ public void open(Player player) { targetPlayerTexture = new String[]{null, null}; } } - ItemStack phead = XSkull.createItem().profile(new Profileable.OfflinePlayerProfileable(targetPlayer)).apply(); + + ItemStack phead; + if (targetPlayerTexture.length >= 1 && targetPlayerTexture[0] != null) { + phead = SkullItemCreator.byTextureValue(targetPlayerTexture[0]); + } else { + phead = SkullItemCreator.byUuid(targetPlayerUUID); + } + nInv.addItem( nInv.createItem(phead, plugin.formatText( diff --git a/src/main/java/com/craftaro/skyblock/menus/Information.java b/src/main/java/com/craftaro/skyblock/menus/Information.java index 552a3566..e2fc08f3 100644 --- a/src/main/java/com/craftaro/skyblock/menus/Information.java +++ b/src/main/java/com/craftaro/skyblock/menus/Information.java @@ -1,5 +1,6 @@ package com.craftaro.skyblock.menus; +import com.craftaro.core.utils.SkullItemCreator; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.third_party.com.cryptomorin.xseries.XSound; import com.craftaro.skyblock.SkyBlock; @@ -15,9 +16,6 @@ import com.craftaro.skyblock.utils.item.nInventoryUtil; import com.craftaro.skyblock.utils.player.OfflinePlayer; import com.craftaro.skyblock.visit.Visit; -import com.craftaro.third_party.com.cryptomorin.xseries.profiles.builder.XSkull; -import com.craftaro.third_party.com.cryptomorin.xseries.profiles.objects.ProfileInputType; -import com.craftaro.third_party.com.cryptomorin.xseries.profiles.objects.Profileable; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Material; @@ -25,7 +23,6 @@ import org.bukkit.entity.Player; import org.bukkit.event.inventory.InventoryType; import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.SkullMeta; import java.util.ArrayList; import java.util.List; @@ -344,14 +341,14 @@ public void open(Player player) { nextEndIndex = displayedMembers.size() - playerMenuPage * 36; if (playerMenuPage != 1) { - ItemStack Lhead = XSkull.createItem().profile(new Profileable.StringProfileable("3ebf907494a935e955bfcadab81beafb90fb9be49c7026ba97d798d5f1a23", ProfileInputType.TEXTURE_HASH)).apply(); + ItemStack Lhead = SkullItemCreator.byTextureHash("3ebf907494a935e955bfcadab81beafb90fb9be49c7026ba97d798d5f1a23"); nInv.addItem(nInv.createItem(Lhead, configLoad.getString("Menu.Information.Members.Item.Previous.Displayname"), null, null, null, null), 1); } if (!(nextEndIndex == 0 || nextEndIndex < 0)) { - ItemStack Rhead = XSkull.createItem().profile(new Profileable.StringProfileable("1b6f1a25b6bc199946472aedb370522584ff6f4e83221e5946bd2e41b5ca13b", ProfileInputType.TEXTURE_HASH)).apply(); + ItemStack Rhead = SkullItemCreator.byTextureHash("1b6f1a25b6bc199946472aedb370522584ff6f4e83221e5946bd2e41b5ca13b"); nInv.addItem(nInv.createItem(Rhead, configLoad.getString("Menu.Information.Members.Item.Next.Displayname"), null, null, null, null), 7); @@ -389,7 +386,14 @@ public void open(Player player) { } else { islandRole = configLoad.getString("Menu.Information.Members.Item.Member.Word.Owner"); } - ItemStack phead = XSkull.createItem().profile(new Profileable.OfflinePlayerProfileable(targetPlayer)).apply(); + + ItemStack phead; + if (playerTexture.length >= 1 && playerTexture[0] != null) { + phead = SkullItemCreator.byTextureValue(playerTexture[0]); + } else { + phead = SkullItemCreator.byUuid(playerUUID); + } + nInv.addItem( nInv.createItem(phead, configLoad.getString("Menu.Information.Members.Item.Member.Displayname") @@ -485,14 +489,14 @@ public void open(Player player) { nextEndIndex = displayedVisitors.size() - playerMenuPage * 36; if (playerMenuPage != 1) { - ItemStack Lhead = XSkull.createItem().profile(new Profileable.StringProfileable("3ebf907494a935e955bfcadab81beafb90fb9be49c7026ba97d798d5f1a23", ProfileInputType.TEXTURE_HASH)).apply(); + ItemStack Lhead = SkullItemCreator.byTextureHash("3ebf907494a935e955bfcadab81beafb90fb9be49c7026ba97d798d5f1a23"); nInv.addItem(nInv.createItem(Lhead, configLoad.getString("Menu.Information.Visitors.Item.Previous.Displayname"), null, null, null, null), 1); } if (!(nextEndIndex == 0 || nextEndIndex < 0)) { - ItemStack Rhead = XSkull.createItem().profile(new Profileable.StringProfileable("1b6f1a25b6bc199946472aedb370522584ff6f4e83221e5946bd2e41b5ca13b", ProfileInputType.TEXTURE_HASH)).apply(); + ItemStack Rhead = SkullItemCreator.byTextureHash("1b6f1a25b6bc199946472aedb370522584ff6f4e83221e5946bd2e41b5ca13b"); nInv.addItem(nInv.createItem(Rhead, configLoad.getString("Menu.Information.Visitors.Item.Next.Displayname"), null, null, null, null), 7); @@ -522,7 +526,15 @@ public void open(Player player) { playerData = plugin.getPlayerDataManager().getPlayerData(targetPlayer.getUniqueId()); playerTexture = playerData.getTexture(); } - ItemStack phead = XSkull.createItem().profile(new Profileable.OfflinePlayerProfileable(targetPlayer)).apply(); + + + ItemStack phead; + if (playerTexture.length >= 1 && playerTexture[0] != null) { + phead = SkullItemCreator.byTextureValue(playerTexture[0]); + } else { + phead = SkullItemCreator.byUuid(playerUUID); + } + nInv.addItem( nInv.createItem(phead, configLoad.getString("Menu.Information.Visitors.Item.Visitor.Displayname") diff --git a/src/main/java/com/craftaro/skyblock/menus/Leaderboard.java b/src/main/java/com/craftaro/skyblock/menus/Leaderboard.java index d6d85e5a..9c9e4628 100644 --- a/src/main/java/com/craftaro/skyblock/menus/Leaderboard.java +++ b/src/main/java/com/craftaro/skyblock/menus/Leaderboard.java @@ -1,6 +1,7 @@ package com.craftaro.skyblock.menus; import com.craftaro.core.utils.NumberUtils; +import com.craftaro.core.utils.SkullItemCreator; import com.craftaro.skyblock.SkyBlock; import com.craftaro.skyblock.placeholder.Placeholder; import com.craftaro.skyblock.playerdata.PlayerDataManager; @@ -10,9 +11,6 @@ import com.craftaro.skyblock.visit.Visit; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.third_party.com.cryptomorin.xseries.XSound; -import com.craftaro.third_party.com.cryptomorin.xseries.profiles.builder.XSkull; -import com.craftaro.third_party.com.cryptomorin.xseries.profiles.objects.ProfileInputType; -import com.craftaro.third_party.com.cryptomorin.xseries.profiles.objects.Profileable; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Material; @@ -289,7 +287,14 @@ public void open(Player player) { } } - ItemStack phead = XSkull.createItem().profile(new Profileable.OfflinePlayerProfileable(targetPlayer)).apply(); + + ItemStack phead; + if (playerTexture.length >= 1 && playerTexture[0] != null) { + phead = SkullItemCreator.byTextureValue(playerTexture[0]); + } else { + phead = SkullItemCreator.byUuid(visit.getOwnerUUID()); + } + nInv.addItem( nInv.createItem(phead, configLoad.getString("Menu.Leaderboard.Leaderboard.Item.Island.Displayname") @@ -312,7 +317,7 @@ public void open(Player player) { for (int i = 0; i < itemSlots.length; i++) { if (!nInv.getItems().containsKey(itemSlots[i])) { - ItemStack qhead = XSkull.createItem().profile(new Profileable.StringProfileable("d34e063cafb467a5c8de43ec78619399f369f4a52434da8017a983cdd92516a0", ProfileInputType.TEXTURE_HASH)).apply(); + ItemStack qhead = SkullItemCreator.byTextureHash("d34e063cafb467a5c8de43ec78619399f369f4a52434da8017a983cdd92516a0"); nInv.addItem(nInv.createItem(qhead, configLoad.getString("Menu.Leaderboard.Leaderboard.Item.Empty.Displayname") .replace("%position", "" + (i + 1)), diff --git a/src/main/java/com/craftaro/skyblock/menus/Levelling.java b/src/main/java/com/craftaro/skyblock/menus/Levelling.java index 65fccb6b..656d50c9 100644 --- a/src/main/java/com/craftaro/skyblock/menus/Levelling.java +++ b/src/main/java/com/craftaro/skyblock/menus/Levelling.java @@ -2,6 +2,7 @@ import com.craftaro.core.compatibility.CompatibleMaterial; import com.craftaro.core.compatibility.ServerVersion; +import com.craftaro.core.utils.SkullItemCreator; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.third_party.com.cryptomorin.xseries.XSound; import com.craftaro.core.utils.ItemUtils; @@ -22,9 +23,6 @@ import com.craftaro.skyblock.sound.SoundManager; import com.craftaro.skyblock.utils.NumberUtil; import com.craftaro.skyblock.utils.item.nInventoryUtil; -import com.craftaro.third_party.com.cryptomorin.xseries.profiles.builder.XSkull; -import com.craftaro.third_party.com.cryptomorin.xseries.profiles.objects.ProfileInputType; -import com.craftaro.third_party.com.cryptomorin.xseries.profiles.objects.Profileable; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Material; @@ -34,7 +32,6 @@ import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemFlag; import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.SkullMeta; import java.util.LinkedHashMap; import java.util.List; @@ -227,13 +224,13 @@ public void open(Player player) { nInv.addItem(nInv.createItem(XMaterial.BLACK_STAINED_GLASS_PANE.parseItem(), configLoad.getString("Menu.Levelling.Item.Barrier.Displayname"), null, null, null, null), 9, 10, 11, 12, 13, 14, 15, 16, 17); if (playerMenuPage != 1) { - ItemStack Lhead = XSkull.createItem().profile(new Profileable.StringProfileable("3ebf907494a935e955bfcadab81beafb90fb9be49c7026ba97d798d5f1a23", ProfileInputType.TEXTURE_HASH)).apply(); + ItemStack Lhead = SkullItemCreator.byTextureHash("3ebf907494a935e955bfcadab81beafb90fb9be49c7026ba97d798d5f1a23"); nInv.addItem(nInv.createItem(Lhead, configLoad.getString("Menu.Levelling.Item.Previous.Displayname"), null, null, null, null), 1); } if (!(nextEndIndex == 0 || nextEndIndex < 0)) { - ItemStack Rhead = XSkull.createItem().profile(new Profileable.StringProfileable("1b6f1a25b6bc199946472aedb370522584ff6f4e83221e5946bd2e41b5ca13b", ProfileInputType.TEXTURE_HASH)).apply(); + ItemStack Rhead = SkullItemCreator.byTextureHash("1b6f1a25b6bc199946472aedb370522584ff6f4e83221e5946bd2e41b5ca13b"); nInv.addItem(nInv.createItem(Rhead, configLoad.getString("Menu.Levelling.Item.Next.Displayname"), null, null, null, null), 7); } diff --git a/src/main/java/com/craftaro/skyblock/menus/Members.java b/src/main/java/com/craftaro/skyblock/menus/Members.java index 86f81b61..934b59e0 100644 --- a/src/main/java/com/craftaro/skyblock/menus/Members.java +++ b/src/main/java/com/craftaro/skyblock/menus/Members.java @@ -1,5 +1,6 @@ package com.craftaro.skyblock.menus; +import com.craftaro.core.utils.SkullItemCreator; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.third_party.com.cryptomorin.xseries.XSound; import com.craftaro.skyblock.SkyBlock; @@ -16,9 +17,6 @@ import com.craftaro.skyblock.utils.StringUtil; import com.craftaro.skyblock.utils.item.nInventoryUtil; import com.craftaro.skyblock.utils.player.OfflinePlayer; -import com.craftaro.third_party.com.cryptomorin.xseries.profiles.builder.XSkull; -import com.craftaro.third_party.com.cryptomorin.xseries.profiles.objects.ProfileInputType; -import com.craftaro.third_party.com.cryptomorin.xseries.profiles.objects.Profileable; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Material; @@ -27,7 +25,6 @@ import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.SkullMeta; import java.io.File; import java.text.ParseException; @@ -354,13 +351,13 @@ public void open(Player player, Members.Type type, Members.Sort sort) { 9, 10, 11, 12, 13, 14, 15, 16, 17); if (playerMenuPage != 1) { - ItemStack Lhead = XSkull.createItem().profile(new Profileable.StringProfileable("3ebf907494a935e955bfcadab81beafb90fb9be49c7026ba97d798d5f1a23", ProfileInputType.TEXTURE_HASH)).apply(); + ItemStack Lhead = SkullItemCreator.byTextureHash("3ebf907494a935e955bfcadab81beafb90fb9be49c7026ba97d798d5f1a23"); nInv.addItem(nInv.createItem(Lhead, configLoad.getString("Menu.Members.Item.Previous.Displayname"), null, null, null, null), 1); } if (!(nextEndIndex == 0 || nextEndIndex < 0)) { - ItemStack Rhead = XSkull.createItem().profile(new Profileable.StringProfileable("1b6f1a25b6bc199946472aedb370522584ff6f4e83221e5946bd2e41b5ca13b", ProfileInputType.TEXTURE_HASH)).apply(); + ItemStack Rhead = SkullItemCreator.byTextureHash("1b6f1a25b6bc199946472aedb370522584ff6f4e83221e5946bd2e41b5ca13b"); nInv.addItem(nInv.createItem(Rhead, configLoad.getString("Menu.Members.Item.Next.Displayname"), null, null, null, null), 7); } @@ -563,7 +560,7 @@ public void open(Player player, Members.Type type, Members.Sort sort) { } } - ItemStack phead = XSkull.createItem().profile(new Profileable.UsernameProfileable(playerName)).apply(); + ItemStack phead = SkullItemCreator.byUsername(playerName); nInv.addItem( nInv.createItem(phead, configLoad.getString("Menu.Members.Item.Member.Displayname").replace("%player", diff --git a/src/main/java/com/craftaro/skyblock/menus/Ownership.java b/src/main/java/com/craftaro/skyblock/menus/Ownership.java index f6ce1980..5d8324bc 100644 --- a/src/main/java/com/craftaro/skyblock/menus/Ownership.java +++ b/src/main/java/com/craftaro/skyblock/menus/Ownership.java @@ -1,6 +1,7 @@ package com.craftaro.skyblock.menus; import com.craftaro.core.gui.AnvilGui; +import com.craftaro.core.utils.SkullItemCreator; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.third_party.com.cryptomorin.xseries.XSound; import com.craftaro.skyblock.SkyBlock; @@ -14,8 +15,6 @@ import com.craftaro.skyblock.sound.SoundManager; import com.craftaro.skyblock.utils.item.nInventoryUtil; import com.craftaro.skyblock.utils.player.OfflinePlayer; -import com.craftaro.third_party.com.cryptomorin.xseries.profiles.builder.XSkull; -import com.craftaro.third_party.com.cryptomorin.xseries.profiles.objects.Profileable; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Material; @@ -215,7 +214,7 @@ public void open(Player player) { String originalOwnerName, ownershipPassword = island.getPassword(); String[] playerTexture; - org.bukkit.OfflinePlayer targetPlayer = Bukkit.getServer().getPlayer(island.getOriginalOwnerUUID()); + org.bukkit.OfflinePlayer targetPlayer = Bukkit.getServer().getPlayer(originalOwnerUUID); if (targetPlayer == null) { OfflinePlayer offlinePlayer = new OfflinePlayer(originalOwnerUUID); @@ -225,7 +224,15 @@ public void open(Player player) { originalOwnerName = targetPlayer.getName(); playerTexture = playerDataManager.getPlayerData(targetPlayer.getUniqueId()).getTexture(); } - ItemStack phead = XSkull.createItem().profile(new Profileable.OfflinePlayerProfileable(targetPlayer)).apply(); + + + ItemStack phead; + if (playerTexture.length >= 1 && playerTexture[0] != null) { + phead = SkullItemCreator.byTextureValue(playerTexture[0]); + } else { + phead = SkullItemCreator.byUuid(originalOwnerUUID); + } + nInv.addItem(nInv.createItem(XMaterial.OAK_FENCE_GATE.parseItem(), configLoad.getString("Menu.Ownership.Item.Exit.Displayname"), null, null, null, null), 0); nInv.addItem(nInv.createItem(phead, diff --git a/src/main/java/com/craftaro/skyblock/menus/Visit.java b/src/main/java/com/craftaro/skyblock/menus/Visit.java index 57b8c155..7ec9c896 100644 --- a/src/main/java/com/craftaro/skyblock/menus/Visit.java +++ b/src/main/java/com/craftaro/skyblock/menus/Visit.java @@ -1,5 +1,6 @@ package com.craftaro.skyblock.menus; +import com.craftaro.core.utils.SkullItemCreator; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.third_party.com.cryptomorin.xseries.XSound; import com.craftaro.core.utils.NumberUtils; @@ -19,9 +20,6 @@ import com.craftaro.skyblock.utils.item.nInventoryUtil; import com.craftaro.skyblock.utils.player.OfflinePlayer; import com.craftaro.skyblock.visit.VisitManager; -import com.craftaro.third_party.com.cryptomorin.xseries.profiles.builder.XSkull; -import com.craftaro.third_party.com.cryptomorin.xseries.profiles.objects.ProfileInputType; -import com.craftaro.third_party.com.cryptomorin.xseries.profiles.objects.Profileable; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Material; @@ -29,7 +27,6 @@ import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.SkullMeta; import java.util.ArrayList; import java.util.List; @@ -356,13 +353,13 @@ public void open(Player player, Visit.Type type, Visit.Sort sort) { 9, 10, 11, 12, 13, 14, 15, 16, 17); if (playerMenuPage != 1) { - ItemStack Lhead = XSkull.createItem().profile(new Profileable.StringProfileable("3ebf907494a935e955bfcadab81beafb90fb9be49c7026ba97d798d5f1a23", ProfileInputType.TEXTURE_HASH)).apply(); + ItemStack Lhead = SkullItemCreator.byTextureHash("3ebf907494a935e955bfcadab81beafb90fb9be49c7026ba97d798d5f1a23"); nInv.addItem(nInv.createItem(Lhead, configLoad.getString("Menu.Visit.Item.Previous.Displayname"), null, null, null, null), 1); } if (!(nextEndIndex == 0 || nextEndIndex < 0)) { - ItemStack Rhead = XSkull.createItem().profile(new Profileable.StringProfileable("1b6f1a25b6bc199946472aedb370522584ff6f4e83221e5946bd2e41b5ca13b", ProfileInputType.TEXTURE_HASH)).apply(); + ItemStack Rhead = SkullItemCreator.byTextureHash("1b6f1a25b6bc199946472aedb370522584ff6f4e83221e5946bd2e41b5ca13b"); nInv.addItem(nInv.createItem(Rhead, configLoad.getString("Menu.Visit.Item.Next.Displayname"), null, null, null, null), 7); } @@ -467,7 +464,15 @@ public void open(Player player, Visit.Type type, Visit.Sort sort) { "Menu.Visit.Item.Island.Vote.Enabled.Signature.Disabled.Visitor.Lore")); } } - ItemStack phead = XSkull.createItem().profile(new Profileable.OfflinePlayerProfileable(targetPlayer)).apply(); + + + ItemStack phead; + if (targetPlayerTexture.length >= 1 && targetPlayerTexture[0] != null) { + phead = SkullItemCreator.byTextureValue(targetPlayerTexture[0]); + } else { + phead = SkullItemCreator.byUuid(visit.getOwnerUUID()); + } + nInv.addItem(nInv.createItem(phead, configLoad.getString("Menu.Visit.Item.Island.Displayname").replace("%player", targetPlayerName), @@ -503,7 +508,14 @@ public void open(Player player, Visit.Type type, Visit.Sort sort) { itemLore.addAll(configLoad .getStringList("Menu.Visit.Item.Island.Vote.Disabled.Signature.Disabled.Lore")); } - ItemStack phead = XSkull.createItem().profile(new Profileable.OfflinePlayerProfileable(targetPlayer)).apply(); + + ItemStack phead; + if (targetPlayerTexture.length >= 1 && targetPlayerTexture[0] != null) { + phead = SkullItemCreator.byTextureValue(targetPlayerTexture[0]); + } else { + phead = SkullItemCreator.byUuid(visit.getOwnerUUID()); + } + nInv.addItem(nInv.createItem(phead, configLoad.getString("Menu.Visit.Item.Island.Displayname").replace("%player", targetPlayerName), diff --git a/src/main/java/com/craftaro/skyblock/menus/Visitors.java b/src/main/java/com/craftaro/skyblock/menus/Visitors.java index bf15d6cc..0ab23147 100644 --- a/src/main/java/com/craftaro/skyblock/menus/Visitors.java +++ b/src/main/java/com/craftaro/skyblock/menus/Visitors.java @@ -1,5 +1,6 @@ package com.craftaro.skyblock.menus; +import com.craftaro.core.utils.SkullItemCreator; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.third_party.com.cryptomorin.xseries.XSound; import com.craftaro.skyblock.SkyBlock; @@ -13,18 +14,13 @@ import com.craftaro.skyblock.sound.SoundManager; import com.craftaro.skyblock.utils.NumberUtil; import com.craftaro.skyblock.utils.item.nInventoryUtil; -import com.craftaro.third_party.com.cryptomorin.xseries.profiles.builder.XSkull; -import com.craftaro.third_party.com.cryptomorin.xseries.profiles.objects.ProfileInputType; -import com.craftaro.third_party.com.cryptomorin.xseries.profiles.objects.Profileable; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Material; -import org.bukkit.OfflinePlayer; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.entity.Player; import org.bukkit.event.inventory.ClickType; import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.SkullMeta; import java.util.ArrayList; import java.util.List; @@ -190,13 +186,13 @@ public void open(Player player) { int playerMenuPage = playerData.getPage(MenuType.VISITORS), nextEndIndex = sortedIslandVisitors.size() - playerMenuPage * 36; if (playerMenuPage != 1) { - ItemStack Lhead = XSkull.createItem().profile(new Profileable.StringProfileable("3ebf907494a935e955bfcadab81beafb90fb9be49c7026ba97d798d5f1a23", ProfileInputType.TEXTURE_HASH)).apply(); + ItemStack Lhead = SkullItemCreator.byTextureHash("3ebf907494a935e955bfcadab81beafb90fb9be49c7026ba97d798d5f1a23"); nInv.addItem(nInv.createItem(Lhead, configLoad.getString("Menu.Visitors.Item.Previous.Displayname"), null, null, null, null), 1); } if (!(nextEndIndex == 0 || nextEndIndex < 0)) { - ItemStack Rhead = XSkull.createItem().profile(new Profileable.StringProfileable("1b6f1a25b6bc199946472aedb370522584ff6f4e83221e5946bd2e41b5ca13b", ProfileInputType.TEXTURE_HASH)).apply(); + ItemStack Rhead = SkullItemCreator.byTextureHash("1b6f1a25b6bc199946472aedb370522584ff6f4e83221e5946bd2e41b5ca13b"); nInv.addItem(nInv.createItem(Rhead, configLoad.getString("Menu.Visitors.Item.Next.Displayname"), null, null, null, null), 7); } @@ -220,7 +216,7 @@ public void open(Player player) { if (islandVisitors.size() > index) { inventorySlot++; - OfflinePlayer targetPlayer = Bukkit.getServer().getPlayer((UUID) islandVisitors.toArray()[index]); + Player targetPlayer = Bukkit.getServer().getPlayer((UUID) islandVisitors.toArray()[index]); PlayerData targetPlayerData = playerDataManager.getPlayerData(targetPlayer.getUniqueId()); String[] targetPlayerTexture = targetPlayerData.getTexture(); @@ -273,7 +269,8 @@ public void open(Player player) { "Menu.Visitors.Item.Visitor.Kick.NoPermission.Ban.NoPermission.Lore")); } } - ItemStack phead = XSkull.createItem().profile(new Profileable.OfflinePlayerProfileable(targetPlayer)).apply(); + + ItemStack phead = SkullItemCreator.byPlayer(targetPlayer); nInv.addItem( nInv.createItem(phead, ChatColor.translateAlternateColorCodes('&', diff --git a/src/main/java/com/craftaro/skyblock/menus/admin/Creator.java b/src/main/java/com/craftaro/skyblock/menus/admin/Creator.java index 3f08ecd8..55bdd3c7 100644 --- a/src/main/java/com/craftaro/skyblock/menus/admin/Creator.java +++ b/src/main/java/com/craftaro/skyblock/menus/admin/Creator.java @@ -3,9 +3,7 @@ import com.craftaro.core.compatibility.CompatibleMaterial; import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.core.gui.AnvilGui; -import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; -import com.craftaro.third_party.com.cryptomorin.xseries.XSound; -import com.craftaro.core.utils.ItemUtils; +import com.craftaro.core.utils.SkullItemCreator; import com.craftaro.skyblock.SkyBlock; import com.craftaro.skyblock.config.FileManager; import com.craftaro.skyblock.config.FileManager.Config; @@ -18,9 +16,8 @@ import com.craftaro.skyblock.structure.Structure; import com.craftaro.skyblock.structure.StructureManager; import com.craftaro.skyblock.utils.item.nInventoryUtil; -import com.craftaro.third_party.com.cryptomorin.xseries.profiles.builder.XSkull; -import com.craftaro.third_party.com.cryptomorin.xseries.profiles.objects.ProfileInputType; -import com.craftaro.third_party.com.cryptomorin.xseries.profiles.objects.Profileable; +import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; +import com.craftaro.third_party.com.cryptomorin.xseries.XSound; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.configuration.file.FileConfiguration; @@ -33,7 +30,6 @@ import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; -import org.bukkit.inventory.meta.SkullMeta; import java.io.File; import java.io.IOException; @@ -82,14 +78,14 @@ public void open(Player player) { int playerMenuPage = playerData.getPage(MenuType.ADMIN_CREATOR), nextEndIndex = structures.size() - playerMenuPage * 36; if (playerMenuPage != 1) { - ItemStack Lhead = XSkull.createItem().profile(new Profileable.StringProfileable("3ebf907494a935e955bfcadab81beafb90fb9be49c7026ba97d798d5f1a23", ProfileInputType.TEXTURE_HASH)).apply(); + ItemStack Lhead = SkullItemCreator.byTextureHash("3ebf907494a935e955bfcadab81beafb90fb9be49c7026ba97d798d5f1a23"); nInv.addItem(nInv.createItem(Lhead, configLoad.getString("Menu.Admin.Creator.Browse.Item.Previous.Displayname"), null, null, null, null), 1); } if (!(nextEndIndex == 0 || nextEndIndex < 0)) { - ItemStack Rhead = XSkull.createItem().profile(new Profileable.StringProfileable("1b6f1a25b6bc199946472aedb370522584ff6f4e83221e5946bd2e41b5ca13b", ProfileInputType.TEXTURE_HASH)).apply(); + ItemStack Rhead = SkullItemCreator.byTextureHash("1b6f1a25b6bc199946472aedb370522584ff6f4e83221e5946bd2e41b5ca13b"); nInv.addItem(nInv.createItem(Rhead, configLoad.getString("Menu.Admin.Creator.Browse.Item.Next.Displayname"), null, null, null, null), 7); diff --git a/src/main/java/com/craftaro/skyblock/menus/admin/Generator.java b/src/main/java/com/craftaro/skyblock/menus/admin/Generator.java index 6c6034a7..84d9197e 100644 --- a/src/main/java/com/craftaro/skyblock/menus/admin/Generator.java +++ b/src/main/java/com/craftaro/skyblock/menus/admin/Generator.java @@ -3,6 +3,7 @@ import com.craftaro.core.compatibility.CompatibleMaterial; import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.core.gui.AnvilGui; +import com.craftaro.core.utils.SkullItemCreator; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.third_party.com.cryptomorin.xseries.XSound; import com.craftaro.skyblock.SkyBlock; @@ -17,9 +18,6 @@ import com.craftaro.skyblock.playerdata.PlayerData; import com.craftaro.skyblock.sound.SoundManager; import com.craftaro.skyblock.utils.item.nInventoryUtil; -import com.craftaro.third_party.com.cryptomorin.xseries.profiles.builder.XSkull; -import com.craftaro.third_party.com.cryptomorin.xseries.profiles.objects.ProfileInputType; -import com.craftaro.third_party.com.cryptomorin.xseries.profiles.objects.Profileable; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Material; @@ -80,14 +78,14 @@ public void open(Player player) { int playerMenuPage = playerData.getPage(MenuType.ADMIN_GENERATOR), nextEndIndex = generators.size() - playerMenuPage * 36; if (playerMenuPage != 1) { - ItemStack Lhead = XSkull.createItem().profile(new Profileable.StringProfileable("3ebf907494a935e955bfcadab81beafb90fb9be49c7026ba97d798d5f1a23", ProfileInputType.TEXTURE_HASH)).apply(); + ItemStack Lhead = SkullItemCreator.byTextureHash("3ebf907494a935e955bfcadab81beafb90fb9be49c7026ba97d798d5f1a23"); nInv.addItem(nInv.createItem(Lhead, configLoad.getString("Menu.Admin.Generator.Browse.Item.Previous.Displayname"), null, null, null, null), 1); } if (!(nextEndIndex == 0 || nextEndIndex < 0)) { - ItemStack Rhead = XSkull.createItem().profile(new Profileable.StringProfileable("1b6f1a25b6bc199946472aedb370522584ff6f4e83221e5946bd2e41b5ca13b", ProfileInputType.TEXTURE_HASH)).apply(); + ItemStack Rhead = SkullItemCreator.byTextureHash("1b6f1a25b6bc199946472aedb370522584ff6f4e83221e5946bd2e41b5ca13b"); nInv.addItem(nInv.createItem(Rhead, configLoad.getString("Menu.Admin.Generator.Browse.Item.Next.Displayname"), null, null, null, null), 7); diff --git a/src/main/java/com/craftaro/skyblock/menus/admin/Levelling.java b/src/main/java/com/craftaro/skyblock/menus/admin/Levelling.java index e9230b3a..ed6c1fa3 100644 --- a/src/main/java/com/craftaro/skyblock/menus/admin/Levelling.java +++ b/src/main/java/com/craftaro/skyblock/menus/admin/Levelling.java @@ -3,6 +3,7 @@ import com.craftaro.core.compatibility.CompatibleMaterial; import com.craftaro.core.compatibility.ServerVersion; import com.craftaro.core.gui.AnvilGui; +import com.craftaro.core.utils.SkullItemCreator; import com.craftaro.third_party.com.cryptomorin.xseries.XMaterial; import com.craftaro.third_party.com.cryptomorin.xseries.XSound; import com.craftaro.core.utils.NumberUtils; @@ -17,9 +18,6 @@ import com.craftaro.skyblock.playerdata.PlayerData; import com.craftaro.skyblock.sound.SoundManager; import com.craftaro.skyblock.utils.item.nInventoryUtil; -import com.craftaro.third_party.com.cryptomorin.xseries.profiles.builder.XSkull; -import com.craftaro.third_party.com.cryptomorin.xseries.profiles.objects.ProfileInputType; -import com.craftaro.third_party.com.cryptomorin.xseries.profiles.objects.Profileable; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Material; @@ -32,7 +30,6 @@ import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; -import org.bukkit.inventory.meta.SkullMeta; import java.io.File; import java.io.IOException; @@ -106,13 +103,13 @@ public void open(Player player) { int playerMenuPage = playerData.getPage(MenuType.ADMIN_LEVELLING), nextEndIndex = levellingMaterials.size() - playerMenuPage * 36; if (playerMenuPage != 1) { - ItemStack Lhead = XSkull.createItem().profile(new Profileable.StringProfileable("3ebf907494a935e955bfcadab81beafb90fb9be49c7026ba97d798d5f1a23", ProfileInputType.TEXTURE_HASH)).apply(); + ItemStack Lhead = SkullItemCreator.byTextureHash("3ebf907494a935e955bfcadab81beafb90fb9be49c7026ba97d798d5f1a23"); nInv.addItem(nInv.createItem(Lhead, configLoad.getString("Menu.Admin.Levelling.Item.Previous.Displayname"), null, null, null, null), 1); } if (!(nextEndIndex == 0 || nextEndIndex < 0)) { - ItemStack Rhead = XSkull.createItem().profile(new Profileable.StringProfileable("1b6f1a25b6bc199946472aedb370522584ff6f4e83221e5946bd2e41b5ca13b", ProfileInputType.TEXTURE_HASH)).apply(); + ItemStack Rhead = SkullItemCreator.byTextureHash("1b6f1a25b6bc199946472aedb370522584ff6f4e83221e5946bd2e41b5ca13b"); nInv.addItem(nInv.createItem(Rhead, configLoad.getString("Menu.Admin.Levelling.Item.Next.Displayname"), null, null, null, null), 7); }