From 152ae89024b02ac3f086a5755e80eff58d7b87e4 Mon Sep 17 00:00:00 2001 From: Marc Baloup Date: Tue, 14 Sep 2021 23:10:12 +0200 Subject: [PATCH] Added method to quickly retrieve the prefix width in Chat API --- Core/src/main/java/fr/pandacube/lib/core/chat/Chat.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Core/src/main/java/fr/pandacube/lib/core/chat/Chat.java b/Core/src/main/java/fr/pandacube/lib/core/chat/Chat.java index 548b3ed..897bf84 100644 --- a/Core/src/main/java/fr/pandacube/lib/core/chat/Chat.java +++ b/Core/src/main/java/fr/pandacube/lib/core/chat/Chat.java @@ -453,6 +453,10 @@ public abstract class Chat extends ChatStatic implements HoverEventSource prefix; + public int getPrefixWidth(boolean console) { + Chat c = prefix == null ? null : prefix.get(); + return c == null ? 0 : ChatUtil.componentWidth(c.getAdv(), console); + } }