From 25257f990d050e1d6023eb2fed5d08acff7af298 Mon Sep 17 00:00:00 2001 From: Keuin Date: Sun, 14 Aug 2022 13:21:33 +0800 Subject: Better message replay displaying. --- .../com/keuin/crosslink/plugin/common/PluginMain.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/main/java/com/keuin/crosslink/plugin/common/PluginMain.java b/src/main/java/com/keuin/crosslink/plugin/common/PluginMain.java index b84a4cf..a89a815 100644 --- a/src/main/java/com/keuin/crosslink/plugin/common/PluginMain.java +++ b/src/main/java/com/keuin/crosslink/plugin/common/PluginMain.java @@ -25,7 +25,9 @@ import com.keuin.crosslink.util.StartupMessagePrinter; import com.keuin.crosslink.util.version.NewVersionChecker; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.JoinConfiguration; +import net.kyori.adventure.text.format.NamedTextColor; import net.kyori.adventure.text.format.TextColor; +import net.kyori.adventure.text.format.TextDecoration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -105,15 +107,24 @@ public final class PluginMain { "Sending " + ms.size() + " history message(s)."); ms.stream() .map(kv -> Component.join( - JoinConfiguration.separator(Component.text(" ")), - Component.text( + JoinConfiguration.separator(Component.text(" ")), // spacing + Component.text( // message time String.format( "(%s)", DateUtil.getOffsetString(LocalDateTime.ofInstant( Instant.ofEpochMilli(kv.getK()), TimeZone.getDefault().toZoneId()))), - TextColor.color(0x00AA00)), - kv.getV().kyoriMessage())) + NamedTextColor.DARK_GREEN + ), + Component.text( // + String.format("<%s@%s>", + kv.getV().sender().plainTextId(), + kv.getV().source().friendlyName()), + TextColor.color(NamedTextColor.GRAY), + TextDecoration.ITALIC + ), + kv.getV().kyoriMessage().colorIfAbsent(NamedTextColor.GRAY) // message body + )) .forEach(msg -> coreAccessor.sendPlayerMessage(uuid, msg)); } ); -- cgit v1.2.3