This commit is contained in:
Chipmunk 2023-04-15 15:16:04 -04:00
parent 483ba18302
commit 1b6f040122
2 changed files with 16 additions and 8 deletions

View file

@ -3,9 +3,14 @@ package land.chipmunk.chipmunkbot.command;
import land.chipmunk.chipmunkbot.data.MutablePlayerListEntry;
import land.chipmunk.chipmunkbot.util.UUIDUtilities;
import land.chipmunk.chipmunkbot.ChipmunkBot;
import com.github.steveice10.mc.auth.data.GameProfile;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.NamedTextColor;
import net.kyori.adventure.text.format.TextDecoration;
import net.kyori.adventure.text.format.Style;
import net.kyori.adventure.text.event.ClickEvent;
import net.kyori.adventure.text.event.HoverEvent;
import net.kyori.adventure.key.Key;
import java.util.UUID;
public class PlayerCommandSource extends CommandSource {
@ -26,7 +31,17 @@ public class PlayerCommandSource extends CommandSource {
@Override
public Component displayName () {
return Component.selector(player.profile().getId().toString());
final GameProfile profile = player.profile();
final String username = profile.getName();
final UUID uuid = profile.getId();
final Style style = Style.style()
.insertion(username)
.clickEvent(ClickEvent.suggestCommand("/tell " + username + " "))
.hoverEvent(HoverEvent.showEntity(Key.key("minecraft", "player"), uuid, Component.text(username)))
.build();
return Component.text(username, style);
}
@Override public MutablePlayerListEntry player () { return this.player; }

View file

@ -1,7 +0,0 @@
package land.chipmunk.chipmunkbot.data.chat;
import net.kyori.adventure.text.Component;
public interface PlayerMessageParser {
PlayerMessage parse (Component message);
}