From 9491046935f4dee57adf60271a4735ed56975119 Mon Sep 17 00:00:00 2001 From: lexikiq Date: Fri, 11 Jun 2021 20:06:28 -0400 Subject: [PATCH] Improve Player#asComponent --- api/src/main/java/com/velocitypowered/api/proxy/Player.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/api/src/main/java/com/velocitypowered/api/proxy/Player.java b/api/src/main/java/com/velocitypowered/api/proxy/Player.java index 3c72d70df..be83ee4b6 100644 --- a/api/src/main/java/com/velocitypowered/api/proxy/Player.java +++ b/api/src/main/java/com/velocitypowered/api/proxy/Player.java @@ -31,6 +31,7 @@ import net.kyori.adventure.key.Keyed; import net.kyori.adventure.pointer.Pointers; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.ComponentLike; +import net.kyori.adventure.text.event.ClickEvent; import net.kyori.adventure.text.event.HoverEvent; import net.kyori.adventure.text.event.HoverEventSource; import org.checkerframework.checker.nullness.qual.Nullable; @@ -292,7 +293,9 @@ public interface Player extends CommandSource, Identified, InboundConnection, @Override default @NotNull Component asComponent() { - return Component.text(getUsername()).hoverEvent(this); + return Component.text(getUsername()).hoverEvent(this) + .clickEvent(ClickEvent.suggestCommand("/tell " + getUsername())) + .insertion(getUsername()); } @Override