mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-01 00:10:40 +01:00
Panel should ignore color codes when checking player name for heads
Fixes https://github.com/BentoBoxWorld/BentoBox/issues/1343
This commit is contained in:
parent
2c004ce504
commit
9a517446c8
@ -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;
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user