From c35002eb4d04232e55d490f0b22478c7264b577a Mon Sep 17 00:00:00 2001 From: TeamHR Date: Sun, 3 Mar 2024 21:24:27 +0530 Subject: [PATCH 1/4] [Fixes] Leaderboard Skull not loading and showing black skulls. --- .../craftaro/skyblock/menus/Leaderboard.java | 1 + .../playerdata/PlayerDataManager.java | 29 ++++++++----------- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/craftaro/skyblock/menus/Leaderboard.java b/src/main/java/com/craftaro/skyblock/menus/Leaderboard.java index a325d59a..aac4519b 100644 --- a/src/main/java/com/craftaro/skyblock/menus/Leaderboard.java +++ b/src/main/java/com/craftaro/skyblock/menus/Leaderboard.java @@ -308,6 +308,7 @@ public class Leaderboard { playerTexture = steveSkinTexture; } } + ItemStack phead = SkullUtils.getSkull(targetPlayer.getUniqueId()); ItemStack phead = SkullUtils.getSkull(targetPlayer.getUniqueId()); nInv.addItem( diff --git a/src/main/java/com/craftaro/skyblock/playerdata/PlayerDataManager.java b/src/main/java/com/craftaro/skyblock/playerdata/PlayerDataManager.java index 02bfc188..4ee2a4df 100644 --- a/src/main/java/com/craftaro/skyblock/playerdata/PlayerDataManager.java +++ b/src/main/java/com/craftaro/skyblock/playerdata/PlayerDataManager.java @@ -3,27 +3,22 @@ package com.craftaro.skyblock.playerdata; import com.craftaro.skyblock.SkyBlock; import com.craftaro.skyblock.ban.BanManager; import com.craftaro.skyblock.config.FileManager; -import com.craftaro.skyblock.island.Island; -import com.craftaro.skyblock.island.IslandLocation; -import com.craftaro.skyblock.island.IslandManager; -import com.craftaro.skyblock.island.IslandRole; -import com.craftaro.skyblock.island.IslandStatus; -import com.craftaro.skyblock.island.IslandWorld; +import com.craftaro.skyblock.island.*; import com.craftaro.skyblock.message.MessageManager; import com.craftaro.skyblock.scoreboard.ScoreboardManager; import com.craftaro.skyblock.utils.player.OfflinePlayer; import com.craftaro.skyblock.utils.world.LocationUtil; import com.craftaro.skyblock.visit.Visit; import com.craftaro.skyblock.world.WorldManager; -import com.mojang.authlib.GameProfile; -import com.mojang.authlib.properties.Property; +import com.craftaro.third_party.com.cryptomorin.xseries.SkullUtils; import org.bukkit.Bukkit; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; import java.io.File; import java.io.IOException; -import java.lang.reflect.Method; import java.util.HashMap; import java.util.Map; import java.util.UUID; @@ -58,21 +53,21 @@ public class PlayerDataManager { FileConfiguration configLoad = config.getFileConfiguration(); String[] playerTexture; - + String something = null; try { - Object entityPlayer = player.getClass().getMethod("getHandle").invoke(player); - Method getProfileMethod = entityPlayer.getClass().getMethod("getProfile"); - GameProfile gameProfile = (GameProfile) getProfileMethod.invoke(entityPlayer); - Property property = gameProfile.getProperties().get("textures").iterator().next(); - playerTexture = new String[]{property.getSignature(), property.getValue()}; + ItemStack skullItem = SkullUtils.getSkull(player.getUniqueId()); + ItemMeta skullMeta = skullItem.getItemMeta(); + something = SkullUtils.getSkinValue(skullMeta); + System.out.println(something); } catch (Exception e) { + e.printStackTrace(); playerTexture = new String[]{ "K9P4tCIENYbNpDuEuuY0shs1x7iIvwXi4jUUVsATJfwsAIZGS+9OZ5T2HB0tWBoxRvZNi73Vr+syRdvTLUWPusVXIg+2fhXmQoaNEtnQvQVGQpjdQP0TkZtYG8PbvRxE6Z75ddq+DVx/65OSNHLWIB/D+Rg4vINh4ukXNYttn9QvauDHh1aW7/IkIb1Bc0tLcQyqxZQ3mdglxJfgIerqnlA++Lt7TxaLdag4y1NhdZyd3OhklF5B0+B9zw/qP8QCzsZU7VzJIcds1+wDWKiMUO7+60OSrIwgE9FPamxOQDFoDvz5BOULQEeNx7iFMB+eBYsapCXpZx0zf1bduppBUbbVC9wVhto/J4tc0iNyUq06/esHUUB5MHzdJ0Y6IZJAD/xIw15OLCUH2ntvs8V9/cy5/n8u3JqPUM2zhUGeQ2p9FubUGk4Q928L56l3omRpKV+5QYTrvF+AxFkuj2hcfGQG3VE2iYZO6omXe7nRPpbJlHkMKhE8Xvd1HP4PKpgivSkHBoZ92QEUAmRzZydJkp8CNomQrZJf+MtPiNsl/Q5RQM+8CQThg3+4uWptUfP5dDFWOgTnMdA0nIODyrjpp+bvIJnsohraIKJ7ZDnj4tIp4ObTNKDFC/8j8JHz4VCrtr45mbnzvB2DcK8EIB3JYT7ElJTHnc5BKMyLy5SKzuw=", "eyJ0aW1lc3RhbXAiOjE1MjkyNTg0MTE4NDksInByb2ZpbGVJZCI6Ijg2NjdiYTcxYjg1YTQwMDRhZjU0NDU3YTk3MzRlZWQ3IiwicHJvZmlsZU5hbWUiOiJTdGV2ZSIsInNpZ25hdHVyZVJlcXVpcmVkIjp0cnVlLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZGMxYzc3Y2U4ZTU0OTI1YWI1ODEyNTQ0NmVjNTNiMGNkZDNkMGNhM2RiMjczZWI5MDhkNTQ4Mjc4N2VmNDAxNiJ9LCJDQVBFIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYjc2N2Q0ODMyNWVhNTMyNDU2MTQwNmI4YzgyYWJiZDRlMjc1NWYxMTE1M2NkODVhYjA1NDVjYzIifX19"}; } - configLoad.set("Texture.Signature", playerTexture[0]); - configLoad.set("Texture.Value", playerTexture[1]); + configLoad.set("Texture.Signature", ""); + configLoad.set("Texture.Value", something); configLoad.set("Statistics.Island.Playtime", 0); try { From 0f51665bc3382b0c94cc9df044a5809d793f0a05 Mon Sep 17 00:00:00 2001 From: TeamHR Date: Sun, 3 Mar 2024 22:46:18 +0530 Subject: [PATCH 2/4] [Fixes] Leaderboard Skull not loading and showing black skulls. [CleanUp] Cleaned Debug Messages --- .../craftaro/skyblock/menus/Leaderboard.java | 1 - .../playerdata/PlayerDataManager.java | 29 +++++++++++-------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/craftaro/skyblock/menus/Leaderboard.java b/src/main/java/com/craftaro/skyblock/menus/Leaderboard.java index aac4519b..a325d59a 100644 --- a/src/main/java/com/craftaro/skyblock/menus/Leaderboard.java +++ b/src/main/java/com/craftaro/skyblock/menus/Leaderboard.java @@ -308,7 +308,6 @@ public class Leaderboard { playerTexture = steveSkinTexture; } } - ItemStack phead = SkullUtils.getSkull(targetPlayer.getUniqueId()); ItemStack phead = SkullUtils.getSkull(targetPlayer.getUniqueId()); nInv.addItem( diff --git a/src/main/java/com/craftaro/skyblock/playerdata/PlayerDataManager.java b/src/main/java/com/craftaro/skyblock/playerdata/PlayerDataManager.java index 4ee2a4df..02bfc188 100644 --- a/src/main/java/com/craftaro/skyblock/playerdata/PlayerDataManager.java +++ b/src/main/java/com/craftaro/skyblock/playerdata/PlayerDataManager.java @@ -3,22 +3,27 @@ package com.craftaro.skyblock.playerdata; import com.craftaro.skyblock.SkyBlock; import com.craftaro.skyblock.ban.BanManager; import com.craftaro.skyblock.config.FileManager; -import com.craftaro.skyblock.island.*; +import com.craftaro.skyblock.island.Island; +import com.craftaro.skyblock.island.IslandLocation; +import com.craftaro.skyblock.island.IslandManager; +import com.craftaro.skyblock.island.IslandRole; +import com.craftaro.skyblock.island.IslandStatus; +import com.craftaro.skyblock.island.IslandWorld; import com.craftaro.skyblock.message.MessageManager; import com.craftaro.skyblock.scoreboard.ScoreboardManager; import com.craftaro.skyblock.utils.player.OfflinePlayer; import com.craftaro.skyblock.utils.world.LocationUtil; import com.craftaro.skyblock.visit.Visit; import com.craftaro.skyblock.world.WorldManager; -import com.craftaro.third_party.com.cryptomorin.xseries.SkullUtils; +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.properties.Property; import org.bukkit.Bukkit; import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.ItemMeta; import java.io.File; import java.io.IOException; +import java.lang.reflect.Method; import java.util.HashMap; import java.util.Map; import java.util.UUID; @@ -53,21 +58,21 @@ public class PlayerDataManager { FileConfiguration configLoad = config.getFileConfiguration(); String[] playerTexture; - String something = null; + try { - ItemStack skullItem = SkullUtils.getSkull(player.getUniqueId()); - ItemMeta skullMeta = skullItem.getItemMeta(); - something = SkullUtils.getSkinValue(skullMeta); - System.out.println(something); + Object entityPlayer = player.getClass().getMethod("getHandle").invoke(player); + Method getProfileMethod = entityPlayer.getClass().getMethod("getProfile"); + GameProfile gameProfile = (GameProfile) getProfileMethod.invoke(entityPlayer); + Property property = gameProfile.getProperties().get("textures").iterator().next(); + playerTexture = new String[]{property.getSignature(), property.getValue()}; } catch (Exception e) { - e.printStackTrace(); playerTexture = new String[]{ "K9P4tCIENYbNpDuEuuY0shs1x7iIvwXi4jUUVsATJfwsAIZGS+9OZ5T2HB0tWBoxRvZNi73Vr+syRdvTLUWPusVXIg+2fhXmQoaNEtnQvQVGQpjdQP0TkZtYG8PbvRxE6Z75ddq+DVx/65OSNHLWIB/D+Rg4vINh4ukXNYttn9QvauDHh1aW7/IkIb1Bc0tLcQyqxZQ3mdglxJfgIerqnlA++Lt7TxaLdag4y1NhdZyd3OhklF5B0+B9zw/qP8QCzsZU7VzJIcds1+wDWKiMUO7+60OSrIwgE9FPamxOQDFoDvz5BOULQEeNx7iFMB+eBYsapCXpZx0zf1bduppBUbbVC9wVhto/J4tc0iNyUq06/esHUUB5MHzdJ0Y6IZJAD/xIw15OLCUH2ntvs8V9/cy5/n8u3JqPUM2zhUGeQ2p9FubUGk4Q928L56l3omRpKV+5QYTrvF+AxFkuj2hcfGQG3VE2iYZO6omXe7nRPpbJlHkMKhE8Xvd1HP4PKpgivSkHBoZ92QEUAmRzZydJkp8CNomQrZJf+MtPiNsl/Q5RQM+8CQThg3+4uWptUfP5dDFWOgTnMdA0nIODyrjpp+bvIJnsohraIKJ7ZDnj4tIp4ObTNKDFC/8j8JHz4VCrtr45mbnzvB2DcK8EIB3JYT7ElJTHnc5BKMyLy5SKzuw=", "eyJ0aW1lc3RhbXAiOjE1MjkyNTg0MTE4NDksInByb2ZpbGVJZCI6Ijg2NjdiYTcxYjg1YTQwMDRhZjU0NDU3YTk3MzRlZWQ3IiwicHJvZmlsZU5hbWUiOiJTdGV2ZSIsInNpZ25hdHVyZVJlcXVpcmVkIjp0cnVlLCJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZGMxYzc3Y2U4ZTU0OTI1YWI1ODEyNTQ0NmVjNTNiMGNkZDNkMGNhM2RiMjczZWI5MDhkNTQ4Mjc4N2VmNDAxNiJ9LCJDQVBFIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYjc2N2Q0ODMyNWVhNTMyNDU2MTQwNmI4YzgyYWJiZDRlMjc1NWYxMTE1M2NkODVhYjA1NDVjYzIifX19"}; } - configLoad.set("Texture.Signature", ""); - configLoad.set("Texture.Value", something); + configLoad.set("Texture.Signature", playerTexture[0]); + configLoad.set("Texture.Value", playerTexture[1]); configLoad.set("Statistics.Island.Playtime", 0); try { From 373d5267d4acdb082be1f35c31d22b4c8948299d Mon Sep 17 00:00:00 2001 From: TeamHR Date: Mon, 25 Mar 2024 23:08:29 +0530 Subject: [PATCH 3/4] [Fixed] /is members Was throwing NPE for Players --- .../java/com/craftaro/skyblock/menus/Members.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/craftaro/skyblock/menus/Members.java b/src/main/java/com/craftaro/skyblock/menus/Members.java index c29e0be2..f99b3396 100644 --- a/src/main/java/com/craftaro/skyblock/menus/Members.java +++ b/src/main/java/com/craftaro/skyblock/menus/Members.java @@ -398,12 +398,12 @@ public class Members { int islandPlaytime; - org.bukkit.OfflinePlayer targetPlayer = Bukkit.getServer().getOfflinePlayer(playerUUID); + Player targetPlayer = Bukkit.getServer().getPlayer(playerUUID); if (targetPlayer == null) { OfflinePlayer offlinePlayer = new OfflinePlayer(playerUUID); playerName = offlinePlayer.getName(); - playerTexture = offlinePlayer.getTexture(); + //playerTexture = offlinePlayer.getTexture(); islandPlaytime = offlinePlayer.getPlaytime(); playTimeDurationTime = NumberUtil.getDuration(Integer.valueOf(islandPlaytime)); @@ -419,8 +419,8 @@ public class Members { } else { playerName = targetPlayer.getName(); - playerData = plugin.getPlayerDataManager().getPlayerData(targetPlayer.getUniqueId()); - playerTexture = playerData.getTexture(); + playerData = plugin.getPlayerDataManager().getPlayerData(targetPlayer); + //playerTexture = playerData.getTexture(); islandPlaytime = playerData.getPlaytime(); playTimeDurationTime = NumberUtil.getDuration(islandPlaytime); @@ -571,7 +571,8 @@ public class Members { } } } - ItemStack phead = SkullUtils.getSkull(targetPlayer.getUniqueId()); + + ItemStack phead = SkullUtils.getSkull(Bukkit.getPlayerUniqueId(playerName)); nInv.addItem( nInv.createItem(phead, configLoad.getString("Menu.Members.Item.Member.Displayname").replace("%player", From 389b9087fdd76b01c24e970aa5de8f9bb4c9dc57 Mon Sep 17 00:00:00 2001 From: TeamHR Date: Tue, 26 Mar 2024 16:43:25 +0530 Subject: [PATCH 4/4] [Fixed] Island Scan MinY Level fixed. Instead of 0 it will now fetch from World.MinHeight. --- .../java/com/craftaro/skyblock/blockscanner/BlockScanner.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/craftaro/skyblock/blockscanner/BlockScanner.java b/src/main/java/com/craftaro/skyblock/blockscanner/BlockScanner.java index 716a6b72..82dd1923 100644 --- a/src/main/java/com/craftaro/skyblock/blockscanner/BlockScanner.java +++ b/src/main/java/com/craftaro/skyblock/blockscanner/BlockScanner.java @@ -114,7 +114,7 @@ public final class BlockScanner extends BukkitRunnable { if (ignoreY) { startY = world.getMaxHeight(); } else { - startY = !ignoreLiquidsY && liquidSection.getBoolean("Enable") && !config.getBoolean("Island.Levelling.ScanLiquid") ? liquidSection.getInt("Height") + 1 : 0; + startY = !ignoreLiquidsY && liquidSection.getBoolean("Enable") && !config.getBoolean("Island.Levelling.ScanLiquid") ? liquidSection.getInt("Height") + 1 : world.getMinHeight(); } for (List sub : parts) {