mirror of
https://github.com/plexusorg/Plex.git
synced 2024-12-22 17:17:37 +00:00
Use a variable for the chat component & if they have a prefix, append the prefix to that variable instead of using else if
This commit is contained in:
parent
cbbdb0248f
commit
d716f77ac0
@ -61,20 +61,15 @@ public class ChatListener extends PlexListener
|
|||||||
public @NotNull Component render(@NotNull Player source, @NotNull Component sourceDisplayName, @NotNull Component message, @NotNull Audience viewer)
|
public @NotNull Component render(@NotNull Player source, @NotNull Component sourceDisplayName, @NotNull Component message, @NotNull Audience viewer)
|
||||||
{
|
{
|
||||||
String text = ((TextComponent)message).content();
|
String text = ((TextComponent)message).content();
|
||||||
|
Component component = Component.empty();
|
||||||
|
|
||||||
if (hasPrefix)
|
if (hasPrefix)
|
||||||
{
|
{
|
||||||
return Component.empty()
|
component = component.append(prefix);
|
||||||
.append(prefix)
|
|
||||||
.append(Component.space())
|
|
||||||
.append(PlexUtils.mmDeserialize(plugin.config.getString("chat.name-color", "<white>") + MiniMessage.builder().tags(TagResolver.resolver(StandardTags.color(), StandardTags.rainbow(), StandardTags.decorations(), StandardTags.gradient(), StandardTags.transition())).build().serialize(sourceDisplayName)))
|
|
||||||
.append(Component.space())
|
|
||||||
.append(Component.text("»").color(NamedTextColor.GRAY))
|
|
||||||
.append(Component.space())
|
|
||||||
.append(PlexUtils.mmDeserialize(text))
|
|
||||||
.replaceText(URL_REPLACEMENT_CONFIG);
|
|
||||||
}
|
}
|
||||||
return Component.empty()
|
|
||||||
|
return component
|
||||||
|
.append(Component.space())
|
||||||
.append(PlexUtils.mmDeserialize(plugin.config.getString("chat.name-color", "<white>") + MiniMessage.builder().tags(TagResolver.resolver(StandardTags.color(), StandardTags.rainbow(), StandardTags.decorations(), StandardTags.gradient(), StandardTags.transition())).build().serialize(sourceDisplayName)))
|
.append(PlexUtils.mmDeserialize(plugin.config.getString("chat.name-color", "<white>") + MiniMessage.builder().tags(TagResolver.resolver(StandardTags.color(), StandardTags.rainbow(), StandardTags.decorations(), StandardTags.gradient(), StandardTags.transition())).build().serialize(sourceDisplayName)))
|
||||||
.append(Component.space())
|
.append(Component.space())
|
||||||
.append(Component.text("»").color(NamedTextColor.GRAY))
|
.append(Component.text("»").color(NamedTextColor.GRAY))
|
||||||
|
Loading…
Reference in New Issue
Block a user