QoL change for /npc glowing --color to enable if not previously enabled

This commit is contained in:
fullwall 2020-04-22 18:00:15 +08:00
parent 5e431462e0
commit 4bbe797120
1 changed files with 3 additions and 0 deletions

View File

@ -640,6 +640,9 @@ public class NPCCommands {
if (!(npc.getEntity() instanceof Player))
throw new CommandException(Messages.GLOWING_COLOR_PLAYER_ONLY);
npc.getTrait(ScoreboardTrait.class).setColor(chatColor);
if (!npc.data().has(NPC.GLOWING_METADATA)) {
npc.data().setPersistent(NPC.GLOWING_METADATA, true);
}
Messaging.sendTr(sender, Messages.GLOWING_COLOR_SET, npc.getName(),
chatColor == null ? ChatColor.WHITE + "white" : chatColor + Util.prettyEnum(chatColor));
return;