Added method to quickly retrieve the prefix width in Chat API

This commit is contained in:
Marc Baloup 2021-09-14 23:10:12 +02:00
parent f243a56af2
commit 152ae89024
Signed by: marcbal
GPG Key ID: BBC0FE3ABC30B893

View File

@ -453,6 +453,10 @@ public abstract class Chat extends ChatStatic implements HoverEventSource<Compon
public TextColor broadcastColor = NamedTextColor.YELLOW; public TextColor broadcastColor = NamedTextColor.YELLOW;
public Supplier<Chat> prefix; public Supplier<Chat> prefix;
public int getPrefixWidth(boolean console) {
Chat c = prefix == null ? null : prefix.get();
return c == null ? 0 : ChatUtil.componentWidth(c.getAdv(), console);
}
} }