3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-11-16 21:10:30 +01:00

Rename method + add JD

Dieser Commit ist enthalten in:
lexikiq 2021-06-11 22:15:12 -04:00
Ursprung 39d39e58bd
Commit 56a46d051b
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: AE6C11E94FDBB116

Datei anzeigen

@ -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());