From 56a46d051b01ced6e9d0a6cfe65216347801d936 Mon Sep 17 00:00:00 2001 From: lexikiq Date: Fri, 11 Jun 2021 22:15:12 -0400 Subject: [PATCH] Rename method + add JD --- .../main/java/com/velocitypowered/api/proxy/Player.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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 611c25b3..7cfbe75c 100644 --- a/api/src/main/java/com/velocitypowered/api/proxy/Player.java +++ b/api/src/main/java/com/velocitypowered/api/proxy/Player.java @@ -289,7 +289,7 @@ public interface Player extends CommandSource, Identified, InboundConnection, return CommandSource.super.pointers().toBuilder() .withDynamic(Identity.UUID, this::getUniqueId) .withDynamic(Identity.NAME, this::getUsername) - .withDynamic(Identity.DISPLAY_NAME, this::asComponent) + .withDynamic(Identity.DISPLAY_NAME, this::getDisplayName) .build(); } @@ -298,7 +298,12 @@ public interface Player extends CommandSource, Identified, InboundConnection, return Key.key("player"); } - default @NotNull Component asComponent() { + /** + * Gets a {@link Component} that renders a player name similarly to vanilla. + * + * @return a Component representing this player + */ + default @NotNull Component getDisplayName() { return Component.text(getUsername()).hoverEvent(this) .clickEvent(ClickEvent.suggestCommand("/tell " + getUsername())) .insertion(getUsername());