From d2e63d5b39c17424801f63be724541614f19b6a9 Mon Sep 17 00:00:00 2001 From: tastybento Date: Sun, 15 Oct 2017 19:28:40 -0700 Subject: [PATCH] Version 3.0.7.2 up Fix for https://github.com/tastybento/ASkyBlock-Bugs-N-Features/issues/455 --- pom.xml | 2 +- src/com/wasteofplastic/askyblock/TopTen.java | 21 +++++++++++++++++-- .../askyblock/panels/WarpPanel.java | 2 +- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 859bccad4..5a88f2139 100644 --- a/pom.xml +++ b/pom.xml @@ -201,6 +201,6 @@ http://maven.sk89q.com/repo/ - 3.0.7.1 + 3.0.7.2 This pom contains reference to a lot of servers that are not included in the GitHub repository because they are binary objects and maybe subject to copyright. These are used so that the NMS code that is used especially for pasting of islands can operate. Before you can build successfully, you need to put zero or more server binaries into the lib directory on your build machine. This version will match the version of the server you will use, for example 1.12. Then delete all the unneeded packages in com.wasteofplastic.askyblock.nms that you do not need or do not have. This will allow you to build. If you have no server binaries and delete all the packages, the Bukkit API will be used instead of NMS, which is slow and not recommended. Good luck! diff --git a/src/com/wasteofplastic/askyblock/TopTen.java b/src/com/wasteofplastic/askyblock/TopTen.java index 1b993eb90..af64a0cb1 100644 --- a/src/com/wasteofplastic/askyblock/TopTen.java +++ b/src/com/wasteofplastic/askyblock/TopTen.java @@ -57,6 +57,7 @@ public class TopTen implements Listener{ private static Map topTenList = new HashMap(); private static final int GUISIZE = 27; // Must be a multiple of 9 private static final int[] SLOTS = new int[] {4, 12, 14, 19, 20, 21, 22, 23, 24, 25}; + private static final boolean DEBUG = false; // Store this as a static because it's the same for everyone and saves memory cleanup private static Inventory gui; @@ -293,12 +294,16 @@ public static boolean topTenShow(final Player player) { } } } else { + if (DEBUG) + plugin.getLogger().info("DEBUG: new GUI display"); // New GUI display (shown by default) if (topTenList == null) topTenCreate(); topTenList = MapUtil.sortByValue(topTenList); // Create the top ten GUI if it does not exist if (gui == null) { gui = Bukkit.createInventory(null, GUISIZE, plugin.myLocale(player.getUniqueId()).topTenGuiTitle); + if (DEBUG) + plugin.getLogger().info("DEBUG: creating GUI for the first time"); } // Reset gui.clear(); @@ -307,7 +312,8 @@ public static boolean topTenShow(final Player player) { while (it.hasNext()) { Map.Entry m = it.next(); UUID playerUUID = m.getKey(); - //plugin.getLogger().info("DEBUG: " + i + ": " + playerUUID); + if (DEBUG) + plugin.getLogger().info("DEBUG: " + i + ": " + playerUUID); // Remove from TopTen if the player is online and has the permission Player entry = plugin.getServer().getPlayer(playerUUID); boolean show = true; @@ -316,6 +322,10 @@ public static boolean topTenShow(final Player player) { it.remove(); show = false; } + } else { + if (DEBUG) + plugin.getLogger().info("DEBUG: player not online, so no per check"); + } if (show) { gui.setItem(SLOTS[i-1], getSkull(i, m.getValue(), playerUUID)); @@ -329,7 +339,14 @@ public static boolean topTenShow(final Player player) { } static ItemStack getSkull(int rank, Long long1, UUID player){ - String playerName = plugin.getServer().getOfflinePlayer(player).getName(); + if (DEBUG) + plugin.getLogger().info("DEBUG: Getting the skull"); + String playerName = plugin.getPlayers().getName(player); + if (DEBUG) { + plugin.getLogger().info("DEBUG: playername = " + playerName); + + plugin.getLogger().info("DEBUG: second chance = " + plugin.getPlayers().getName(player)); + } ItemStack playerSkull = new ItemStack(Material.SKULL_ITEM, 1, (short) 3); if (playerName == null) return null; SkullMeta meta = (SkullMeta) playerSkull.getItemMeta(); diff --git a/src/com/wasteofplastic/askyblock/panels/WarpPanel.java b/src/com/wasteofplastic/askyblock/panels/WarpPanel.java index 5edc1a76f..98cb72aba 100644 --- a/src/com/wasteofplastic/askyblock/panels/WarpPanel.java +++ b/src/com/wasteofplastic/askyblock/panels/WarpPanel.java @@ -137,7 +137,7 @@ public void addWarp(UUID playerUUID) { * @return Player skull item */ private ItemStack getSkull(UUID playerUUID) { - String playerName = plugin.getServer().getOfflinePlayer(playerUUID).getName(); + String playerName = plugin.getPlayers().getName(playerUUID); if (DEBUG) plugin.getLogger().info("DEBUG: name of warp = " + playerName); ItemStack playerSkull = new ItemStack(Material.SKULL_ITEM, 1, (short) 3);