diff --git a/src/main/java/land/chipmunk/chipmunkbot/command/PlayerCommandSource.java b/src/main/java/land/chipmunk/chipmunkbot/command/PlayerCommandSource.java index d13b5f4..e5b2dbc 100644 --- a/src/main/java/land/chipmunk/chipmunkbot/command/PlayerCommandSource.java +++ b/src/main/java/land/chipmunk/chipmunkbot/command/PlayerCommandSource.java @@ -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; } diff --git a/src/main/java/land/chipmunk/chipmunkbot/data/chat/PlayerMessageParser.java b/src/main/java/land/chipmunk/chipmunkbot/data/chat/PlayerMessageParser.java deleted file mode 100644 index 8d9c27b..0000000 --- a/src/main/java/land/chipmunk/chipmunkbot/data/chat/PlayerMessageParser.java +++ /dev/null @@ -1,7 +0,0 @@ -package land.chipmunk.chipmunkbot.data.chat; - -import net.kyori.adventure.text.Component; - -public interface PlayerMessageParser { - PlayerMessage parse (Component message); -} \ No newline at end of file