Skip to content

Commit

Permalink
Fix names longer than 16 characters
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Mar 31, 2016
1 parent d561fe9 commit e295a10
Showing 1 changed file with 4 additions and 5 deletions.
Expand Up @@ -34,11 +34,8 @@ public HumanController() {
protected Entity createEntity(final Location at, final NPC npc) {
final WorldServer nmsWorld = ((CraftWorld) at.getWorld()).getHandle();
String coloredName = Colorizer.parseColors(npc.getFullName());
if (coloredName.length() > 16) {
coloredName = coloredName.substring(0, 16);
}

String name, prefix = null, suffix = null;
String name = coloredName, prefix = null, suffix = null;
if (coloredName.length() > 16) {
prefix = coloredName.substring(0, 16);
if (coloredName.length() > 30) {
Expand Down Expand Up @@ -66,7 +63,9 @@ protected Entity createEntity(final Location at, final NPC npc) {
name = name.substring(0, 16);
}
}
coloredName = coloredName.substring(0, 16);
}

final String prefixCapture = prefix, suffixCapture = suffix;

UUID uuid = npc.getUniqueId();
Expand All @@ -77,7 +76,7 @@ protected Entity createEntity(final Location at, final NPC npc) {
uuid = new UUID(msb, uuid.getLeastSignificantBits());
}

GameProfile profile = new GameProfile(uuid, coloredName);
GameProfile profile = new GameProfile(uuid, name);

final EntityHumanNPC handle = new EntityHumanNPC(nmsWorld.getServer().getServer(), nmsWorld, profile,
new PlayerInteractManager(nmsWorld), npc);
Expand Down

0 comments on commit e295a10

Please sign in to comment.