From cda3171a875b0d16d4226031953d1ac779a8f012 Mon Sep 17 00:00:00 2001 From: fullwall Date: Fri, 30 May 2014 01:05:53 +0800 Subject: [PATCH] Better skin handling for colored names --- .../java/net/citizensnpcs/npc/entity/HumanController.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/citizensnpcs/npc/entity/HumanController.java b/src/main/java/net/citizensnpcs/npc/entity/HumanController.java index 926c37e0a..df2682b24 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/HumanController.java +++ b/src/main/java/net/citizensnpcs/npc/entity/HumanController.java @@ -23,6 +23,7 @@ import net.minecraft.util.com.mojang.authlib.properties.Property; import org.bukkit.Bukkit; import org.bukkit.Location; +import org.bukkit.ChatColor; import org.bukkit.craftbukkit.v1_7_R3.CraftServer; import org.bukkit.craftbukkit.v1_7_R3.CraftWorld; import org.bukkit.entity.Entity; @@ -77,7 +78,7 @@ public class HumanController extends AbstractEntityController { skinUUID = npc.getName(); } if (npc.data().has(CACHED_SKIN_UUID_METADATA) && npc.data().has(CACHED_SKIN_UUID_NAME_METADATA) - && skinUUID.equalsIgnoreCase(npc.data(). get(CACHED_SKIN_UUID_NAME_METADATA))) { + && ChatColor.stripColor(skinUUID).equalsIgnoreCase(ChatColor.stripColor(npc.data(). get(CACHED_SKIN_UUID_NAME_METADATA)))) { skinUUID = npc.data().get(CACHED_SKIN_UUID_METADATA); } if (UUID_CACHE.containsKey(skinUUID)) { @@ -151,7 +152,7 @@ public class HumanController extends AbstractEntityController { } final GameProfileRepository repo = ((CraftServer) Bukkit.getServer()).getServer() .getGameProfileRepository(); - repo.findProfilesByNames(new String[] { reportedUUID }, Agent.MINECRAFT, new ProfileLookupCallback() { + repo.findProfilesByNames(new String[] { ChatColor.stripColor(reportedUUID) }, Agent.MINECRAFT, new ProfileLookupCallback() { @Override public void onProfileLookupFailed(GameProfile arg0, Exception arg1) { throw new RuntimeException(arg1);