Skip to content

Commit

Permalink
Be more flexible in getFullName() too
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Oct 26, 2022
1 parent 8c82a5e commit 9f21659
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/main/java/net/citizensnpcs/api/npc/AbstractNPC.java
Expand Up @@ -221,12 +221,13 @@ protected EntityType getEntityType() {
@Override
public String getFullName() {
int nameLength = SpigotUtil.getMaxNameLength(getEntityType());
if (name.length() > nameLength) {
Messaging.severe("ID", id, "created with name length greater than " + nameLength + ", truncating", name,
"to", name.substring(0, nameLength));
name = name.substring(0, nameLength);
String replaced = Placeholders.replace(Colorizer.parseColors(name), null, this);
if (replaced.length() > nameLength) {
Messaging.severe("ID", id, "created with name length greater than " + nameLength + ", truncating", replaced,
"to", replaced.substring(0, nameLength));
replaced = replaced.substring(0, nameLength);
}
return Placeholders.replace(Colorizer.parseColors(name), null, this);
return replaced;
}

@Override
Expand Down

0 comments on commit 9f21659

Please sign in to comment.