Use new util method

This commit is contained in:
fullwall 2020-05-15 12:26:21 +08:00
parent d484432f83
commit 4633b75c24
1 changed files with 2 additions and 1 deletions

View File

@ -77,6 +77,7 @@ import net.citizensnpcs.api.trait.trait.Speech;
import net.citizensnpcs.api.util.Colorizer;
import net.citizensnpcs.api.util.Messaging;
import net.citizensnpcs.api.util.Paginator;
import net.citizensnpcs.api.util.SpigotUtil;
import net.citizensnpcs.npc.EntityControllers;
import net.citizensnpcs.npc.NPCSelector;
import net.citizensnpcs.npc.Template;
@ -420,7 +421,7 @@ public class NPCCommands {
}
}
int nameLength = type == EntityType.PLAYER ? 46 : 64;
int nameLength = SpigotUtil.getMaxNameLength(type);
if (name.length() > nameLength) {
Messaging.sendErrorTr(sender, Messages.NPC_NAME_TOO_LONG, nameLength);
name = name.substring(0, nameLength);