add playerNameComponent support in Chat API
This commit is contained in:
parent
316894dbe0
commit
6b7098eacd
@ -101,6 +101,8 @@ public abstract class Chat extends ChatStatic implements HoverEventSource<Compon
|
||||
|
||||
public Chat thenPlayerName(String legacyText) { return then(playerNameText(legacyText)); }
|
||||
|
||||
public Chat thenPlayerName(Component comp) { return then(playerNameComponent(comp)); }
|
||||
|
||||
public Chat thenNewLine() { return then(Component.newline()); }
|
||||
|
||||
public Chat thenLegacyText(Object legacyText) { return then(legacyText(legacyText)); }
|
||||
|
@ -59,6 +59,13 @@ public abstract class ChatStatic {
|
||||
return legacyText(legacyText).white();
|
||||
}
|
||||
|
||||
public static FormatableChat playerNameComponent(Component c) {
|
||||
FormatableChat fc = chatComponent(c);
|
||||
if (c.color() == null)
|
||||
fc.white();
|
||||
return fc;
|
||||
}
|
||||
|
||||
public static FormatableChat translation(String key, Object... with) {
|
||||
return chatComponent(Component.translatable(key, Chat.filterObjToComponentLike(with)));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user