Skip to content

Commit

Permalink
Better skin handling for colored names
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed May 29, 2014
1 parent 80622f6 commit 5e198e6
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

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;
Expand Down Expand Up @@ -77,7 +78,7 @@ private void updateSkin(final NPC npc, final WorldServer nmsWorld, GameProfile p
skinUUID = npc.getName();
}
if (npc.data().has(CACHED_SKIN_UUID_METADATA) && npc.data().has(CACHED_SKIN_UUID_NAME_METADATA)
&& skinUUID.equalsIgnoreCase(npc.data().<String> get(CACHED_SKIN_UUID_NAME_METADATA))) {
&& ChatColor.stripColor(skinUUID).equalsIgnoreCase(ChatColor.stripColor(npc.data().<String> get(CACHED_SKIN_UUID_NAME_METADATA)))) {
skinUUID = npc.data().get(CACHED_SKIN_UUID_METADATA);
}
if (UUID_CACHE.containsKey(skinUUID)) {
Expand Down Expand Up @@ -151,7 +152,7 @@ public String call() throws Exception {
}
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);
Expand Down

2 comments on commit 5e198e6

@the-sane
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a terrible idea. Now all the NPCs which I had named using color codes to force the default "Steve" skin have random player skins instead that look hideous.

Please provide a method of forcing the default Steve skin on certain NPCs.

@fullwall
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simple - just use /npc skin to a steve skin

Please sign in to comment.