diff --git a/src/main/java/world/bentobox/bentobox/api/panels/Panel.java b/src/main/java/world/bentobox/bentobox/api/panels/Panel.java index 32429ff0b..ecac637f3 100644 --- a/src/main/java/world/bentobox/bentobox/api/panels/Panel.java +++ b/src/main/java/world/bentobox/bentobox/api/panels/Panel.java @@ -5,6 +5,7 @@ import java.util.Optional; import java.util.stream.Collectors; import org.bukkit.Bukkit; +import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.inventory.InventoryType; @@ -197,7 +198,7 @@ public class Panel implements HeadRequester, InventoryHolder { ItemStack it = inventory.getItem(i); if (it != null && it.getType().equals(Material.PLAYER_HEAD)) { ItemMeta meta = it.getItemMeta(); - if (meta != null && item.getName().equals(meta.getLocalizedName())) { + if (meta != null && ChatColor.stripColor(item.getName()).equals(ChatColor.stripColor(meta.getLocalizedName()))) { inventory.setItem(i, item.getItem()); // If one is found, we are done return; diff --git a/src/test/java/world/bentobox/bentobox/api/panels/PanelTest.java b/src/test/java/world/bentobox/bentobox/api/panels/PanelTest.java index af12e0bc7..dde8e22f9 100644 --- a/src/test/java/world/bentobox/bentobox/api/panels/PanelTest.java +++ b/src/test/java/world/bentobox/bentobox/api/panels/PanelTest.java @@ -28,6 +28,7 @@ import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; +import net.md_5.bungee.api.ChatColor; import world.bentobox.bentobox.api.user.User; import world.bentobox.bentobox.util.heads.HeadGetter; @@ -314,7 +315,7 @@ public class PanelTest { ItemStack itemStack2 = mock(ItemStack.class); when(itemStack2.getType()).thenReturn(Material.PLAYER_HEAD); ItemMeta im2 = mock(ItemMeta.class); - when(im2.getLocalizedName()).thenReturn("tastybento"); + when(im2.getLocalizedName()).thenReturn(ChatColor.WHITE + "" + ChatColor.BOLD + "tastybento"); when(itemStack2.getItemMeta()).thenReturn(im2); PanelItem newItem = mock(PanelItem.class);