summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeuin <[email protected]>2022-08-14 13:21:33 +0800
committerKeuin <[email protected]>2022-08-14 13:21:33 +0800
commit25257f990d050e1d6023eb2fed5d08acff7af298 (patch)
tree728e5a5ac2866e70cc9193854c1c7b4d76a1833a
parentf59f1075cb7e6120831342d9ed655a48f7a294e1 (diff)
Better message replay displaying.
-rw-r--r--src/main/java/com/keuin/crosslink/plugin/common/PluginMain.java19
1 files changed, 15 insertions, 4 deletions
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( // <trueKeuin@survival>
+ 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));
}
);